Error in SQL: SELECT a.*
FROM
articles a
JOIN (
SELECT articleID, at.rank, COUNT(at.articleID) as common_tag_count
FROM
articleTags at
JOIN tags t ON at.tagID = t.tagID WHERE t.tagID IN (50,148,107,138)
GROUP BY articleID, at.rank
) q ON a.articleID = q.articleID
WHERE a.articlePublishDT < '2018-12-19 02:10:32' AND a.articleIsHidden = 0 AND a.articleID !=
ORDER BY q.common_tag_count DESC, q.rank, a.articlePublishDT DESC LIMIT 10[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 'ORDER BY q.common_tag_count DESC, q.rank, a.articlePublishDT DESC LIMIT 10' at line 12]