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 ')
GROUP BY t.title
UNION
SELECT COUNT(*) AS valueCount, t.title AS f' at line 3
SELECT COUNT(*) AS valueCount, t.title AS filterName FROM content_join cj LEFT JOIN activity t ON cj.id2 = t.id WHERE cj.id1 IN () GROUP BY t.title UNION SELECT COUNT(*) AS valueCount, t.title AS filterName FROM content_join cj LEFT JOIN activity t ON cj.id1 = t.id WHERE cj.id2 IN () GROUP BY t.title

