Error: SELECT wa.* FROM web_alerts wa LEFT JOIN web_alerts_read war ON wa.alert_id = war.alert_id AND war.pilot_id = WHERE (wa.alert_expiration > UNIX_TIMESTAMP()) AND ((alert_type = 1) OR (alert_type = 3 AND alert_reference = 0) OR (alert_type = 4 AND alert_reference = 0) OR (alert_type = 5 AND alert_reference IN (SELECT pirep_id FROM pirep WHERE pirep_pilot_id = 0)) ) AND war.alert_id is null ORDER BY wa.alert_id DESC
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE (wa.alert_expiration > UNIX_TIMESTAMP()) AND ((alert_type = 1) ' at line 1