Mysql select with IF function sub query -
i trying query work php. should first check specific booking has not been made query database available vehicles , drivers.
this query far:
if exists(select * bookings left join status bookings.status_id = '.$booking.') begin select * bookings b left join drivers d b.driver_id !="d.driver_id" left join vehicles v b.vehicle_id !="v.vehicle_id" left join status s b.status_id !="'.$booking.'" order b.bookingdate desc end
join bookings:
select * bookings b left join drivers d b.driver_id !="d.driver_id" left join vehicles v b.vehicle_id !="v.vehicle_id" left join status s b.status_id !="'.$booking.'" cross join ( select 1 bookings bookings.status_id = '.$booking.' limit 1 ) t order b.bookingdate desc
Comments
Post a Comment