unable to execute query: select count(n.itemid) as rows from news n where UNIX_TIMESTAMP(n.idate)>(UNIX_TIMESTAMP(CURDATE())-90*24*3600) and (n.langid=1 or (n.langid=1 and n.itemid not in (select m.itemid from news m where m.itemid=n.itemid and m.langid=1 ))) ; 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 'rows from news n where UNIX_TIMESTAMP(n.idate)>(UNIX_TIMESTAMP(CURDATE())-90' at line 1