Ver Mensaje Individual
  #9  
Antiguo 21-06-2011
Avatar de oscarac
[oscarac] oscarac is offline
Miembro Premium
 
Registrado: sep 2006
Ubicación: Lima - Perú
Posts: 2.015
Reputación: 22
oscarac Va por buen camino
mas o menos lo he solucionado asi...
Código SQL [-]
 
Select Left(M.CUENTA,2) As CNivel, M.CUENTA, M.Libro, M.Voucher, M.RGt, M.Documento, M.FechaDocumento, M.Anexo, M.CCosto, 
M.Mnd, M.Glosa, P.Descripcion, 
iif (M.DH = 'D', M.n_IMP , 0.00) AS DEBE,  
iif (M.DH = 'H', M.n_IMP , 0.00) AS HABER 
from (tblmovimientocontable M
Left Join tblPlanContable P On (P.Empresa = '001' and P.Periodo = '2009' and M.Cuenta = P.Cuenta))
where M.Empresa = '001' and M.Periodo = '200902' order by M.CUENTA, M.FechaDocumento 
Union all
Select Left(S.CUENTA,2) As CNivel, S.CUENTA, '' as libro, '' as voucher, '' as rgt, '' as documento, 
'' as fechadocumento, '' as anexo, '' as ccosto, '' as mnd, 
'' as glosa, '' as descripcion, 0 as debe, 0 as haber 
from tblcuentasaldo S 
where (S.nd_ant00 + S.nd_ant01) - (S.nh_ant00 - S.nh_ant01) <> 0 and nv = '6' 
and S.Cuenta not in (Select Cuenta from tblmovimientocontable where Periodo = '200902') 
order by S.Cuenta

aunque creo que mejor usare having
__________________
Dulce Regalo que Satanas manda para mi.....
Responder Con Cita