I have this SQL
select Cuenta, Nombre_Cuenta, sum(Monto)
from
(
select a.cod_cta as Cuenta, b.nom_cta as Nombre_Cuenta, case when a.cod_moneda='2' then floor(sum(imp_mov_mo)) else floor(sum(imp_mov_mn/6000)) end as Monto
from sa_vtos a join ct_cuentas b on a.cod_cta=b.cod_cta
where fec_venc <= '31/12/2015' and imp_mov_mn <>0 and cod_docum = 'pagare'
group by a.cod_cta, b.nom_cta, a.cod_moneda
union all
select a.cod_cta as Cuenta, b.nom_cta as Nombre_Cuenta, case when a.cod_moneda='2' then floor(sum(imp_mov_mo)) else floor(sum(imp_mov_mn/6000)) end as Monto
from cpt_cancedir a join ct_cuentas b on a.cod_cta=b.cod_cta
where fec_venc <= '31/12/2015' and imp_mov_mn <>0 and cod_doca = 'pagare' and fec_doc '31/12/2015' and cod_doc 'difc'
group by a.cod_cta, b.nom_cta, a.cod_moneda
) s group by Cuenta, Nombre_Cuenta, Monto
I want to add the two subquerys, but it's not working