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 p.id ORDER BY p.id DESC' at line 11SQL: SELECT p.id AS post_id, DATE_FORMAT(p.post_date, '%d') AS post_day, DATE_FORMAT(p.post_date, '%b') AS post_month, DATE_FORMAT(p.post_date, '%d %b %Y') AS post_date, DATE_FORMAT(p.post_enddate, '%d %b %Y') AS post_enddate, p.weight, p.height, p.sex, pl.post_title, pl.post_resume, pl.post_text, pi.path, UNIX_TIMESTAMP(p.post_date) AS rss_date, p.category_id FROM post AS p LEFT JOIN post_lang AS pl ON p.id = pl.post_id LEFT JOIN post_image AS pi ON p.id = pi.post_id LEFT JOIN user AS u ON p.user_id = u.user_id LEFT JOIN post_to_stoki_manufacturer AS psm ON p.id = psm.post WHERE p.category_id IN (2,14,15,57,74,75) AND pl.lang_id = 1 AND psm.manufacturer = GROUP BY p.id ORDER BY p.id DESC