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 '* LIMIT mn.date DESC' at line 1SELECT 1=1 FROM `m_newspaper` mn WHERE `mn`.`date`>'-10800' AND `mn`.`date`<'2667600' AND `mn`.`date` >= DATE_SUB(CURDATE(), INTERVAL 6 MONTH) AND 1=1 ORDER BY mn.* LIMIT mn.date DESC;