Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
OldMySQLUser
Constraint Violating Yak Guru
301 Posts |
Posted - 2007-09-16 : 11:06:59
|
| If I have a table which as the following columns/dataitem boxes quantity---- ----- --------CH 20 16CH 10 20CH 15 16how can I get all the CH items so that they are grouped by quantity and the boxes are totalled to give:CH 35 16 10 20please? |
|
|
jsmith8858
Dr. Cross Join
7423 Posts |
Posted - 2007-09-16 : 11:16:37
|
| select item, sum(boxes), quantityfrom yourtablegroup by item, quantityEvery row will and should return the item; to suppress the duplicates or create a group header on item, you would do this at your client report, web page, or application.- Jeffhttp://weblogs.sqlteam.com/JeffS |
 |
|
|
|
|
|