Jump to content

[SOLVED] Help with Query Grouping


kjtocool

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.