Ver Mensaje Individual
  #2  
Antiguo 03-10-2013
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.010
Reputación: 20
oscarac Va por buen camino
Código Delphi [-]
select
b.c_c_empresa,
b.c_cuenta,
Sum (Case when month(a.f_registro) = 1 then (b.t_soles * (Case when c_dbhb = 'D' then 1 else -1 end)) else 0 end) As Enero
from fvoucher_b  b
Left Join fvoucher_a a on b.c_c_empresa =  a.c_c_empresa and b.c_diario = a.c_diario and b.n_anio = a.n_anio and b.n_mes = a.n_mes and b.n_registro = a.n_registro
where isnull(a.flg_anulado,0)=0 and b.n_anio = 2013 and Left(b.c_cuenta,2) = '62' 
Group by
b.c_c_empresa,
b.c_cuenta
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita