Ver Mensaje Individual
  #2  
Antiguo 16-10-2007
Avatar de ContraVeneno
ContraVeneno ContraVeneno is offline
Miembro
 
Registrado: may 2005
Ubicación: Torreón, México
Posts: 4.738
Reputación: 23
ContraVeneno Va por buen camino
En SQL Server harías algo como:
Código SQL [-]
Select F.Factura,
case when datediff(dd, F.FechaFactura, GetDate()) <30 then F.Monto else 0 end dias30,
case when datediff(dd, F.FechaFactura, getdate()) between 31 and 45 then F.Monto else 0 end dias45
case when datediff(dd, F.FechaFactura, getdate()) between 46 and 60 then F.Monto else 0 end dias60
...
...
From Facturas F
where ...
__________________


Última edición por ContraVeneno fecha: 16-10-2007 a las 01:13:16.
Responder Con Cita