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.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Issue with GROUP BY clause using Subquery

Author  Topic 

learntsql

524 Posts

Posted - 2014-01-17 : 09:25:59
Hi Team,

I am using SELECT statement in GROUP BY clause and when i am executing it it is giving an error
saying "Msg 144, Level 15, State 1, Line 4
Cannot use an aggregate or a subquery in an expression used for the group by list of a GROUP BY clause."

Can some one please tell me how to avoid this issue.
TIA.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-01-17 : 09:43:40
can you show us your query ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

RonnieRahman
Starting Member

6 Posts

Posted - 2014-01-17 : 10:35:53
quote:
Originally posted by learntsql

Hi Team,

I am using SELECT statement in GROUP BY clause and when i am executing it it is giving an error
saying "Msg 144, Level 15, State 1, Line 4
Cannot use an aggregate or a subquery in an expression used for the group by list of a GROUP BY clause."

Can some one please tell me how to avoid this issue.
TIA.




I think the link below might solve your issue - otherwise please share your query here
[url]http://stackoverflow.com/questions/9873646/cannot-use-an-aggregate-or-a-subquery-in-an-expression-used-for-the-group-by-lis[/url]
Go to Top of Page
   

- Advertisement -