I have this query that works
Code: Select all
$query="SELECT li.rid, li.addone, li.bed, li.tariffCode, li.starRating, li.img1, li.img2 ,li.city , so.percentage, so.start_date, so.end_date, so.status FROM listings AS li LEFT JOIN special_offers AS so ON li.rid = so.rid WHERE li.llid = $llid AND so.status = 1 AND so.end_date > $date_now ORDER BY rand() LIMIT 4 ";
i thought maybe adding something like
Code: Select all
LEFT JOIN weeks AS w ON so.rid = w.rid AND so.start_date <= w.date_vacant AND so.end_date > w.date_vacant
Code: Select all
so.start_date <= w.date_vacant AND so.end_date > w.date_vacantCan anyone point me in the right direction.
Thanks