Forum Moderators: open
Select sum(Price) as P from Table
but this doesnt work:
Select top 12 sum(Price) as P from Table Order by Price
I get this error: "...is invalid in the ORDER BY clause because it is not contained in either an aggregate function or the GROUP BY clause."
Does what I'm trying to do make sense?
To work, Table will have to have a unique ID (SomeID) to use to identify a specific row. And you may need to tweek the query a bit depoending on the DB you're using.
[edited by: LifeinAsia at 9:10 pm (utc) on June 19, 2008]