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 |
jfm
Posting Yak Master
145 Posts |
Posted - 2013-05-09 : 06:54:49
|
Hi there, I have the following query: select blue, red, green, id, heightfrom table1group by blue, red, green, id, heighthaving count (*) =1 The matter is that HAVING COUNT I just want to count the Id's, not the other columns that I have in group by. Any tips? Thank you |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-05-09 : 06:59:16
|
do you mean this?select blue, red, green, id, heightfrom table1group by blue, red, green, id, heighthaving count (id) =1 ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
Lamprey
Master Smack Fu Yak Hacker
4614 Posts |
Posted - 2013-05-09 : 10:55:28
|
quote: Originally posted by jfm Hi there, I have the following query: select blue, red, green, id, heightfrom table1group by blue, red, green, id, heighthaving count (*) =1 The matter is that HAVING COUNT I just want to count the Id's, not the other columns that I have in group by. Any tips? Thank you
Depends on what your data is and what you want for output. With over a hundred posts I'm surprised you still don't post sample data and expected output. If you want to provide that we can certainly help you out.http://www.sqlservercentral.com/articles/Best+Practices/61537/http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
|
|
|
|