SQL: SELECT COUNT(*) FROM [Table]GQitems i, [Table]GQmessage m WHERE i.itemid=m.itemid AND i.catid IN () AND 1 Error: 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 ') AND 1' at line 1 Errno.: 1064