Ver Mensaje Individual
  #5  
Antiguo 14-12-2005
FOURIER FOURIER is offline
Miembro
 
Registrado: dic 2005
Posts: 40
Reputación: 0
FOURIER Va por buen camino
Espero que te ayude

SELECT CLIENTE.NROSOCIO AS SOCIO, CLIENTE.NOMBRE AS CLIENTE, CLIENTE.APELLIDO AS APELLIDO, CLIENTE.ESTABLECIMIENTO AS ESTABLECIMIENTO, (select SUM(case when espromoesp=true then 0 else FACTURACION.MONTO end) from Facturacion as F where Facturacion.idcliente=cliente.id) AS M_NORMAL, (select SUM(case when espromoesp=true then FACTURACION.MONTO else 0 end) from facturacion as F where Facturacion.idcliente=cliente.id) AS M_ESPECIAL, (select SUM(FACTURACION.MONTO) from Facturacion as where Facturacion.idcliente=cliente.id) AS TOT_MONTO, (select sum(facturacion.puntos) from Facturacion where idcliente=cliente.id) as Totalpuntos,(SELECT SUM(B.TOTALPUNTOS) FROM CANJE B WHERE B.IDCLIENTE = cliente.id) as canjea,totalpuntos-canjea as puntos_actuales FROM CLIENTE where cliente.idpromo = :IDPROMO ORDER BY CLIENTE.APELLIDO ASC, CLIENTE.ESTABLECIMIENTO ASC


en fin espero que eso te ayude mi estimado
Responder Con Cita