MySQL Forums
Forum List  »  Spanish

Agrupar por fecha
Posted by: Ruben Lezcano
Date: August 02, 2017 04:48AM

Buenos días
como puedo agrupar por fecha y sumar un importe

tengo este codigo

Select p.cliente, p.vendedor, date(p.fechaenvio) as fechaenvio, sum(p.importe_pedido)
From navmp.poee p
Where formaped =1 and p.vendedor= 166 and p.dejarpedido= 0 and borrado=0 and p.devolucion =0 and cliente =43008116
GROUP BY p.pedidokey , p.cliente, p.vendedor, p.fechaenvio desc order by p.fechaenvio desc

El resultado es

4300816 166 2017-08-02 2869.63
4300816 166 2017-08-02 701.13
4300816 166 2017-06-19 1000.45

Yo necesito que se agrupe por fecha y sume


Options: ReplyQuote

Written By
Agrupar por fecha
August 02, 2017 04:48AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.