Error Number: 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 'AND `categoria_id` = '23' AND `subcategoria_id` IS NULL AND `status` = '1' ORDER' at line 6

SELECT * FROM (`st_agendas`) WHERE `id` <> '131' AND `id` < '131' AND `data` <= AND `categoria_id` = '23' AND `subcategoria_id` IS NULL AND `status` = '1' ORDER BY `id` desc, `data` desc