Problemas en el select 1 es: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 'AND (Vigencia='0000-00-00' OR Vigencia >= CURDATE())AND p.Entidad != 'MercadoPag' at line 1