php - Between 2 DATES using CAST and NOT IN -
the following query not functioning properly.
i attempting @ 2 tables , wish return of propertyid's not have booking associated arrival , departure dates of preexisting booking.
i feel should using join of sort (tried referencing this stackoverflow post) not sure that's need utilize ....
in researching have been attempting way (this not working accurately however). can recommend or share better method of performing query desired result?
$btquery = " select * properties pid not in ( select pid property_booking pbdatearrive between cast('".$_get['aadate']."' date) , cast('".$_get['addate']."' date) or pbdatedepart between cast('".$_get['aadate']."' date) , cast('".$_get['addate']."' date))";
greatly appreciate assistance.
in reply check how params being cast: here echo back:
select * properties pid not in ( select pid property_booking pbdatearrive between cast('2016-02-05' date) , cast('2016-02-12' date) or pbdatedepart between cast('2016-02-05' date) , cast('2016-02-12' date))
Comments
Post a Comment