Error
Se produjo un error al acceder a la base de datos
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 'union all select a.fecha as fecha, cep.nombre as concepto, 0 as cargo, a.importe' at line 1
select count(*), sum(cargo), sum(abono) from (select ca.fecha as fecha, cep.nombre as concepto, ca.importe as cargo, 0 as abono, 0 as idctaf from vremcargo ca left join cca cep on ca.idcca=cep.idcca where ca.idvrem= union all select a.fecha as fecha, cep.nombre as concepto, 0 as cargo, a.importe as abono, a.idctaf as idctaf from vremabo a left join cca cep on a.idcca=cep.idcca where a.idvrem= order by fecha) nm_sel_esp