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 |
|
mkgmahi
Starting Member
24 Posts |
Posted - 2011-07-24 : 08:01:53
|
| Hi Folks,I am facing an issue in an SQL Query where in i need to group and get summation for some of the rows by main column and the other rows by the other individual column. I have tried providing the two columns in the group by but they are getting grouped by individual column. Please help me outEX cola colb colc cold 1 sec 234 2 sec sec1 233 |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2011-07-24 : 08:21:10
|
| Please post the query that you have, the table definition and what you want as results.--Gail ShawSQL Server MVP |
 |
|
|
eralper
Yak Posting Veteran
66 Posts |
Posted - 2011-07-25 : 01:53:27
|
| Hello,You can use SUM() aggregate function with Group By clauseBesides, you can use SUM() OVER (Partition By) clause. In this case it is not necessary to use Group ByIn this sample [url]http://www.kodyaz.com/t-sql/sql-count-function-with-partition-by-clause.aspx[/url] the aggregate function Count() is used with Partition By clause. You can use Sum() and other aggregate functions with Partition clause as well-------------Eralperhttp://www.kodyaz.com |
 |
|
|
|
|
|