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

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -