Answer the question
In order to leave comments, you need to log in
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 ] );
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question