class.mysql.php : 1054 - Unknown column 'pay.pay_create' in 'order clause' - SELECT * FROM (SELECT ogl.id, ogl.ident, ogl.title, ogl.category, ogl.city, ogl.city_rw, ogl.district, ogl.state, ogl.country, ogl.cost, ogl.cost_notice, ogl.cost_currency, ogl.for_free, ogl.status, ogl.display, ogl.forever, ogl.urgent, ogl.create_date, ogl.whole_country, ogl.delivery_enabled, ogl.delivery_info, MAX(CASE WHEN pay.pay_type = 'VIEW' THEN pay.pay_expire ELSE NULL END) AS view_till, MAX(CASE WHEN pay.pay_type = 'PROMOTED' THEN pay.pay_expire ELSE NULL END) AS promoted_till, (SELECT GROUP_CONCAT(ph.photo_filename ORDER BY ph.photo_main = 'YES' DESC) FROM ogl24_announcement_photos AS ph WHERE ph.photo_announcement_id = ogl.id) AS photos FROM ogl24_announcement AS ogl LEFT JOIN ogl24_announcement_payments AS pay ON ogl.ident=pay.pay_ident LEFT JOIN ogl24_company AS comp ON comp.company_id = ogl.company_id WHERE ogl.status='ACCEPT' AND ogl.display = 'TRUE' AND (((pay.pay_create <= '2025-01-30' OR pay.pay_create IS NULL) AND pay.pay_expire >= '2024-04-05') OR ogl.forever = 'TRUE') AND ((ogl.city LIKE '%berkshire%' OR ogl.city_rw LIKE '%berkshire%') OR (ogl.whole_country = 'TRUE')) AND ogl.category IN (1837) GROUP BY ogl.id ) AS x ORDER BY (((pay.pay_create <= '2025-01-30' OR pay.pay_create IS NULL) AND pay.pay_expire >= '2025-01-30') OR ogl.forever = 'TRUE') DESC, promoted_till >= '2025-01-30' DESC, ogl.create_date DESC LIMIT 0,20