kjtocool Posted June 5, 2008 Share Posted June 5, 2008 Table data looks something like so: prod_id - ver_id - total_num 1 - 11 - 34 1 - 11 - 28 1 - 11 - 45 1 - 12 - 27 1 - 12 - 87 1 - 14 - 97 1 - 14 - 28 2 - 11 - 28 2 - 11 - 76 2 - 12 - 87 and so on. Essentially what I want to return is: 1 - 11 - Sum of all 1 - 12 - Sum of all 1 - 14 - Sum of all 2 - 11 - Sum of all 2 - 12 - Sum of all How would I go about this? Select prod_id, ver_id, SUM(total_num) Group By ver_id, prod_id? Link to comment https://forums.phpfreaks.com/topic/108846-solved-help-with-query-grouping/ Share on other sites More sharing options...
Barand Posted June 5, 2008 Share Posted June 5, 2008 almost Select prod_id, ver_id, SUM(total_num) Group By prod_id, ver_id Link to comment https://forums.phpfreaks.com/topic/108846-solved-help-with-query-grouping/#findComment-558534 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.