mysql sum group by

Solutions on MaxInterview for mysql sum group by by the best coders in the world

showing results for - "mysql sum group by"
Emilio
01 Sep 2018
1-- SELECT SUM(<column_name>) FROM <table_name> WHERE <condition>;
2SELECT SUM(amount) FROM invoices;
3SELECT client_name, SUM(amount) FROM invoices GROUP BY client_name;
Martyn
17 Jan 2017
1-- Sum Columns only show up in SELECT statement 
2-- All other columns must be in both
3SELECT categories_column, SUM(units_column) AS total_units
4FROM schema.table
5GROUP BY categories_column;