|
SELECT ad.id, ad.section_id, ad.uid, ad.cid, ad.currency_id, ad.wanted, ad.auction_id, ad.dealer_id, ad.make, ad.year_of_make, ad.type, ad.body, ad.part_category, ad.part_manufacturer, ad.part_type, ad.part_model, ad.location, ad.price, ad.publish_up, ad.publish_down, ad.status, ad.images, ad.description, ad.featured_exp_date, ad.featured, client.agreement_expiration_date FROM #__caradvert_ads_total AS ad INNER JOIN #__caradvert_clients AS client ON (ad.cid = client.cid) WHERE ad.section_id = '1' AND ad.make = 'Zenith mc' AND ad.published = '1' AND ( ad.publish_down < '2012-02-04 07:09:18' AND `publish_down` != '0000-00-00 00:00:00' AND client.agreement_expiration_date = '0000-00-00 00:00:00' OR client.agreement_expiration_date != '0000-00-00 00:00:00' AND client.agreement_expiration_date < '2012-02-04 07:09:18' OR ad.status = 'SOLD' ) ORDER BY ad.publish_up DESC LIMIT 0, 20
NEW vehicles and parts are marked GREEN, |