0
select DATE(added), SUM(amount) ,currency 
from transactions 
where  DATE(added)  > subdate(CURDATE(),10) 
AND status = 'APPROVED' GROUP BY  DATE(added);

This will return one sum per day which is wrong since i have many currencies. i want to get daily sum's by currency. example:

24/10/2019 EUR 15000
24/10/2019 USD 18000

23/10/2019 EUR 55000
23/10/2019 USD 68000
5
  • And? what is the question?
    – Akina
    Oct 24 '19 at 11:20
  • How i will get the results like this 24/10/2019 EUR 15000 24/10/2019 USD 18000 23/10/2019 EUR 55000 23/10/2019 USD 68000 the above query will return : 24/10/2019 USD 18000 23/10/2019 USD 18000 It will sum up all currencies Oct 24 '19 at 11:30
  • Adjust your group by according to your wishes.. - group by date will only deliver 1 set of data for the whole day ... you want probably group by currency, DATE(added) - untested though
    – eagle275
    Oct 24 '19 at 11:34
  • what about you clarify your question? Oct 24 '19 at 12:16
  • He's probably assuming his result example is enough clarification - And for me it was
    – eagle275
    Oct 24 '19 at 12:34
0

... adding to my recent comment ...

http://sqlfiddle.com/#!9/8e8f57/4

select DATE(added), SUM(amount) ,currency 
from transactions 
where  DATE(added)  > subdate(CURDATE(),10) 
  AND status = 'APPROVED' 
GROUP BY  currency,DATE(added)
ORDER BY DATE(added) desc; 

delivers daily amounts separated by currency as you wanted

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.