Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > SQL
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

 
 
Herramientas Buscar en Tema Desplegado
  #11  
Antiguo 14-12-2005
hmoner hmoner is offline
Miembro
 
Registrado: may 2005
Posts: 52
Poder: 20
hmoner Va por buen camino
Bueno bueno...
Faltan palabras de agradecimiento para FOURIER, quien tan amablemente se ha ofrecido a ayudarme con mi problema, a traves del MSN Messenger, y se ha quedado hasta que finalmente pude hacer funcionar y unificar la consulta.
Hoy, he tenido muchisima suerte... gracias FOURIER.
Aqui la consulta terminada, por si a alguien le sirve...

Compatible con NEXUS ( motor de base de datos 3rdparty para Delphi - www.nexusdb.com )

Código SQL [-]
 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 F.MONTO end) 
 from Facturacion as F 
 where F.idcliente = cliente.id) AS M_NORMAL, 
 (select SUM(case when espromoesp=true then F.MONTO else 0 end) 
 from facturacion as F 
 where F.idcliente = cliente.id) AS M_ESPECIAL, 
 (select SUM(FAC.MONTO) 
 from Facturacion as FAC
 where FAC.idcliente=cliente.id) AS TOT_MONTO, 
 (select sum(facturacion.puntos) 
 from Facturacion 
 where idcliente=cliente.id) as totalpuntosganados, (SELECT SUM(B.TOTALPUNTOS) 
 FROM CANJE B WHERE B.IDCLIENTE = cliente.id) as totalpuntoscanjeados, (select sum(facturacion.puntos) 
 from Facturacion 
 where idcliente=cliente.id) - (SELECT SUM(B.TOTALPUNTOS) 
 FROM CANJE B WHERE B.IDCLIENTE = cliente.id) as puntos_actuales 
 FROM CLIENTE where cliente.idpromo = :PIDPROMO
 ORDER BY CLIENTE.APELLIDO ASC, CLIENTE.ESTABLECIMIENTO ASC
Responder Con Cita
 



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro


La franja horaria es GMT +2. Ahora son las 07:03:06.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi