SQL Server Performance Forum – Threads Archive
to use aggregate function with other columns
MS SQL does not support to use aggregate function along with other Columns even if we have GROUP BY clause.<br />like…<br />SELECT <SomeField>, Count(<FieldName><img src=’/community/emoticons/emotion-5.gif’ alt=’![Wink ;) ;)](styles/default/xenforo/smilies/wink.png)
That should be<br /><br />SELECT <SomeField>, Count(<FieldName><img src=’/community/emoticons/emotion-5.gif’ alt=’
![Wink ;) ;)](styles/default/xenforo/smilies/wink.png)
Is this a question or what are you trying to achieve? —
Frank Kalis
Microsoft SQL Server MVP
http://www.insidesql.de
Heute schon gebloggt?http://www.insidesql.de/blogs
<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote"><i>Originally posted by harleen</i><br /><br />MS SQL does not support to use aggregate function along with other Columns even if we have GROUP BY clause.<br />like…<br />SELECT <SomeField>, Count(<FieldName><img src=’/community/emoticons/emotion-5.gif’ alt=’
![Wink ;) ;)](styles/default/xenforo/smilies/wink.png)
>>anyway, one way is use Having if possible and the other is use sub query Having can be used only if Group by is used Madhivanan Failing to plan is Planning to fail
yes I coundn’t mentioned that. Thanks Madhivanan. —————————————-
http://spaces.msn.com/members/dineshasanka
]]>