You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'GROUP BY ORDER BY DESC' at line 11SQL: SELECT 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,, 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 = pl.post_id LEFT JOIN post_image AS pi ON = pi.post_id LEFT JOIN user AS u ON p.user_id = u.user_id LEFT JOIN post_to_stoki_manufacturer AS psm ON = WHERE p.category_id IN (2,14,15,57,74,75) AND pl.lang_id = 2 AND psm.manufacturer = GROUP BY ORDER BY DESC