Mysql Groupby, order not returning individual sums : <pre><code>     $SQL = "SELECT pumpSales._end_date, SUM(pumpSales.AMOUNT) as       
     totalAmount, payments_data.USER
     FROM
     payments_data INNER JOIN pumpSales ON payments_data.Pay_sale_id =   
     pumpSales._sale_id 

     WHERE 
     pumpSales._end_date =CURDATE();

     GROUP BY
     payments_data.USER 

     ORDER BY
     pumpSales._end_date ASC LIMIT 3";
</code></pre>

<p>The result I want is
The users with their individual total amounts
Starting with the highest for the day</p>

<p>But
What I get is the name of one user with total amount for all the users
e.g</p>

<p>2018-01-11   user 1      400,000</p>

<p>where 400,000 is the total for user1, user2, user3</p>
