MySQL Forums
Forum List  »  General

How to use MYSQL GROUP BY SUM with multiple columns
Posted by: Marco Antonio Marco
Date: December 15, 2014 06:21PM

Basically the question is how to get the sum from #hours, groupping by #id, #code, #semester, #year columns from this

id, hours, code, semester, year
165, 6, 3, 1, 2012
166, 6, 16, 1, 2012
460, 8, 14, 2, 2012
461, 8, 16, 2, 2012
462, 15, 16, 2, 2013
463, 6, 1, 2, 2013

id, hours, code, semester, year, sum
165, 6, 3, 1, 2012, ?
166, 6, 16, 1, 2012, ?
460, 8, 14, 2, 2012, ?
461, 8, 16, 2, 2012, ?
462, 15, 16, 2, 2013, ?
463, 6, 1, 2, 2013, ?

I have tried a lot with GROUP BY, GROUP BY CONCAT, etc, but no success.

I want to group by all these columns in each row

Options: ReplyQuote


Subject
Written By
Posted
How to use MYSQL GROUP BY SUM with multiple columns
December 15, 2014 06:21PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.