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 a.id_article <> AND data_publicacio <= CURRENT_DATE GROUP BY a.id_article' at line 1