select a.* from article as a where a.status_id = 2 and count(select h.id from article_history as h where h.article_id = a.id and h.event_id = 5) = 0 [Err] 1064 - You have an error in your SQL syntax; If you’re not sure, you’ll find out where you’re looking for a html from the article_history where h.article_id = a.id and h.event_id = 'at line 3
id- Boris Ustyantsevcount(select h.id from article_history as h where h.article_id = a.id and h.event_id = 5)with(select count(h.id) from article_history as h where h.article_id = a.id and h.event_id = 5)? Although the idea is the same - ChubatiyCOUNTcannot be used inWHERE: only inSELECTand inHAVING. - Regent