Click to See Complete Forum and Search --> : [RESOLVED] Condense a Recordet?


Benjiga
04-01-2006, 03:40 PM
I have a problem that I'm sure is simple to solve but I can't seem to find the answer....

I have a table that contains the following data:

column1 column2 column3
100 5.75 3
100 5.75 1
100 5.75 5
130 3.00 1
130 3.00 4

What I need is to sum column3 based on column1 and I want it to return to rows

column1 column2 column3
100 5.75 9
130 3.00 5

As I write this I am thinking some sort of Select Distinct and Sum(column3) something along those lines...

Any help appreciated.

Thanks.

Benjiga
04-01-2006, 03:50 PM
Alright I found answer within a few minutes of posting this... Sorry for the inconvience.

SELECT column1, column2, SUM(column3) AS quantity FROM #tempcalc WHERE proid=@user GROUP BY column1, column2

For any future use. I hate finding post like this that someone didn't supply their answer to the problem. Thanks