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 |
|
gllen
Starting Member
7 Posts |
Posted - 2006-03-26 : 19:44:26
|
| I have a select statement like this:"SELECT AVG(Price) FROM prices GROUP BY Category"Which of course returns a list of average prices.I want to get a sum of that list, something that would work like this:"SELECT SUM(SELECT AVG(Price) FROM prices GROUP BY Category)"That code doesn't work, but that's what I want it to do and I'm not sure how to do it.Thanks! |
|
|
nr
SQLTeam MVY
12543 Posts |
Posted - 2006-03-26 : 19:50:23
|
| select sum(val) from (SELECT val = AVG(Price) FROM prices GROUP BY Category) a==========================================Cursors are useful if you don't know sql.DTS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
gllen
Starting Member
7 Posts |
Posted - 2006-03-26 : 20:11:44
|
| SWEET!Easier than I thought it would be, thank you very much! |
 |
|
|
|
|
|