1064: 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 'LEAD,ET_BODY AS CONTENT,DATE_FORMAT(t.TEXTDATE,'%d.%m.%Y') AS DATE, se.ID AS SID' at line 1 select t.ET_HEADING AS HEADING, t.ET_LEAD AS LEAD,ET_BODY AS CONTENT,DATE_FORMAT(t.TEXTDATE,'%d.%m.%Y') AS DATE, se.ID AS SID from texts t INNER join structure se on se.ID=t.STR_PLACE where t.ACTIVE=1 AND t.NEWS=1 AND TEXTDATE<='2024-12-07' AND (EDATE>='2024-12-07' OR EDATE='0000-00-00') ORDER BY t.TEXTDATE DESC