Ver Mensaje Individual
  #2  
Antiguo 06-06-2008
Avatar de poliburro
[poliburro] poliburro is offline
Miembro Premium
 
Registrado: ago 2004
Ubicación: México D.F
Posts: 3.068
Reputación: 25
poliburro Va por buen camino
Código SQL [-]
         Select Dep.Id, Isnull(LLE.SumLitLLe,0) SumLitLle, 
                  isnull(Rep.SumLitRep,0) SumLitRep,
                  Isnull(LLE.SumLitLLe,0) - isnull(Rep.SumLitRep,0) LitDif
           From Dep As Dep
      Left Join (
                    Select Id, Sum(Lit) As SumLitLLe
                       From LLE 
                     Where Fec >= :FecIni And
                              Fec <= :FecIni
                  ) LLE 
              On Dep.Id =  LLE.Id 
      Left Join (
                     Select Id, Sum(Lit) As SumLitRep
                       From Rep 
                     Where Fec >= :FecIni And
                              Fec <= :FecIni
                  ) Rep
             On Dep.Id =  Rep.Id 
        Where Dep.Nom = :Nom
__________________
Conoce mi blog http://www.edgartec.com
Responder Con Cita