Michael Buluma Michael Buluma - 1 year ago 75
MySQL Question

How to sum each user totals per category

table preview

I have the above table which I'd like to sum all users total per category. Totals for user 1, User 2, ..., user 20 to be shown at the end of the table. how can i achieve this in Joomla?

Answer Source

This will work

SELECT `Category_ID` ,SUM( `user1` ) AS user1, SUM( `user1` ) AS user2 , ...
FROM `table_name`
GROUP BY `Catagory_ID` 
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download