Skip to content

Instantly share code, notes, and snippets.

@Wqrld
Created March 19, 2023 11:18
Show Gist options
  • Save Wqrld/dce9b16fc887fed530a9fa6204e13c3a to your computer and use it in GitHub Desktop.
Save Wqrld/dce9b16fc887fed530a9fa6204e13c3a to your computer and use it in GitHub Desktop.
select SUM(amount) sum,DATE_FORMAT(STR_TO_DATE(date, '%d-%m-%Y %H:%i'), '%d-%m-%Y') as d
from Payments
WHERE (state = 'approved' or state = 'paid') and client != 1
group by d
order by sum DESC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment