php - how to select from a nested join query -


i have these 2 queries , want join them in order let user filter first query according second one

first query :

select t1 . *  car t1 left outer join rent on t1.carid = rent.carid not  exists (  select null  rent t2 t1.carid = t2.carid  ) or not ( rent.startdate > '$to' or rent.enddate < '$from' ) 

second query:

select carid,model,fuelconsumption,type,picture,color,price,region  car model ='$m' or type='$t' or price='$p' or color = '$c' order model,type,price,color desc 

the 2 queries giving correct answers separately

i not sure understand request, if want merge 2 queries, should this:

select t1.* car t1 left outer join rent on t1.carid = rent.carid  (   not exists   (     select null     rent t2     t1.carid = t2.carid   )   or not   (     rent.startdate > '$to'     or rent.enddate < '$from'   ) ) ,  (   model ='$m'   or type='$t'   or price='$p'   or color = '$c' ) order model,type,price,color desc 

Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -