Ver Mensaje Individual
  #3  
Antiguo 16-06-2012
Avatar de ecfisa
ecfisa ecfisa is offline
Moderador
 
Registrado: dic 2005
Ubicación: Tres Arroyos, Argentina
Posts: 10.508
Reputación: 36
ecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to beholdecfisa is a splendid one to behold
Hola erasmorc.

Compaginé tu código en este mensaje, por que como está en el primero es imposible de leer para quién no sea un criptógrafo avezado.
Código SQL [-]
select CodigoCliente, sum(totalfactura) TotalFactura,
  case when datediff(d,fechafactura,'13/06/2012') BETWEEN  0 and 30 then TotalFacturaend '1-30',
  case when datediff(d,fechafactura,'13/06/2012') BETWEEN 31 and 60 then TotalFacturaend '31-60',
  case when datediff(d,fechafactura,'13/06/2012') BETWEEN 61 and 90 then TotalFacturaend '61-90',
  case when datediff(d,fechafactura,'13/06/2012') BETWEEN 91 and 9999 then TotalFactura '91 o Mas'
  end
from encfactura
where year(fechafactura)= 2012
group by CodigoCliente,
  case when datediff(d,fechafactura,'13/06/2012') BETWEEN  0 and 30 then Total Facturaend,
  case when datediff(d,fechafactura,'13/06/2012') BETWEEN 31 and 60 then TotalFacturaend,
  case when datediff(d,fechafactura,'13/06/2012') BETWEEN 61 and 90 then TotalFacturaend,
  case when datediff(d,fechafactura,'13/06/2012') BETWEEN 91 and 9999 then TotalFactura
  end
order by CodigoCliente
Si me equivoqué en algo al transcribir, hazmelo saber y lo corrigo.

Es por eso que insistimos tanto con las etiquetas...

Saludos.
__________________
Daniel Didriksen

Guía de estilo - Uso de las etiquetas - La otra guía de estilo ....
Responder Con Cita