I
I
Ivan Lykov2018-06-29 14:50:42
Yii
Ivan Lykov, 2018-06-29 14:50:42

Is it possible to pass a value from a subquery to where?

Guys good afternoon. Please advice here is the code

$date = ( new Query() )
        -> from( self ::tableName() )
        -> select( 'date as date_conf, conf_room_id as conf_get_room_id' )
        -> where( [ 'user_id' => $user_id ] )
        -> groupBy( [ 'date_conf' ] );

      $time_start = ( new Query() )
        -> from( self ::tableName() . " booking_room" )
        -> select(
          '
          booking_room.time_start as time_start, 
          conf_room.id as id_space_conf_rom,
          booking_room.conf_room_id,
          
          booking_room.date,
          get_date.date_conf
        '
        )
        -> leftJoin( ConfRooms ::tableName() . " conf_room", 'conf_room.id = booking_room.conf_room_id' )
        -> leftJoin( [ 'get_date' => $date ] , 'get_date.conf_get_room_id = booking_room.conf_room_id' )
        -> where( [ 'booking_room.user_id' => $user_id ] )
        -> andWhere( [ 'booking_room.date' =>  'get_date.date_conf' ] )
        -> orderBy( [ 'booking_room.time_start' => SORT_ASC ] );

This is for requests, I take all dates from $date and give it further to $time_start and want to pass it to where. But where does not want to search by value from the subquery. in general, is it possible to pass a value from under the query to where and how can I solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim Timofeev, 2018-06-29
@webinar

pass value

You didn't pass a value, but a Query() object

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question