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 |
|
divyaram
Posting Yak Master
180 Posts |
Posted - 2011-12-08 : 02:48:24
|
| Hi All, I have table like this----------------------------Article| SP1| sp2|--------------------------art1 |1 |2art2 |2 |3art3 |1 |1art4 |3 |2i would like to get the count of all '1' in SP1 and SP2 together like that I have to get the count of all 2's and 3'sRequired output like this SP Count-------------------- 1 3 2 3 3 2Thanks,DivyaRegards,Divya |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2011-12-08 : 03:25:11
|
[code]select SP, count(*)from(select SP1 as SP from table1union allselect SP2 as SP from table1) as dgroup by SP[/code] KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
|
|
|