Why do you repeat the data?

0

Good morning

I'm doing a query on mysql trying to bring only one result per date but it's bringing me more than two results from the same date, someone to help me with what I have to remove or add to the query.

  SELECT DATE_FORMAT(fecha_pedido, '%Y-%m-%d'),
         SUM(total),
         COUNT(fecha_pedido)
    FROM pedidos
   WHERE nombre_vendedor = 'Luis Fernando Restrepo Medina'
     AND DATE_FORMAT(fecha_pedido, '%Y-%m-%d') BETWEEN '2014-11-25' AND '2016-08-01'
GROUP BY DATE_FORMAT(fecha_pedido, '%Y-%m-%d'), total
ORDER BY DATE_FORMAT(fecha_pedido, '%Y-%m-%d') ASC

This is the result of the query and I do not want to bring two results from the same date, what can I do?

    
asked by Christian Dagnover 01.08.2016 в 17:12
source

1 answer

1

Try removing the TOTAL field from the group by:

GROUP BY DATE_FORMAT(fecha_pedido, '%Y-%m-%d')
    
answered by 01.08.2016 / 17:26
source