Ver Mensaje Individual
  #4 (permalink)  
Antiguo 30/03/2009, 12:51
Avatar de huesos52
huesos52
Colaborador
 
Fecha de Ingreso: febrero-2009
Ubicación: Manizales - Colombia
Mensajes: 5.980
Antigüedad: 15 años, 3 meses
Puntos: 360
Respuesta: Consulta con totales por cliente

Hola periosol

Lo puedes hacer asi:

Código MySQL:
Ver original
  1. SELECT f.cliente,f.comprobante, f.fecha, f.importe, t1.suma FROM facturas_clientes f JOIN (SELECT cliente, sum(importe) as suma FROM facturas_cliente GROUP BY comprobante)t1 on f.cliente=t1.cliente ORDER BY f.cliente into outfile 'c:/consulta.csv' fields terminated by ',' enclosed by '"' lines terminated by '\n';

Espero te sirva.

Un saludo.
__________________
Without data, You are another person with an opinion.
W. Edwads Deming