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 |
jai2808
Starting Member
27 Posts |
Posted - 2008-09-30 : 02:38:19
|
Hi,We have a data in the following formatUserID Status2 A2 A2 R3 AIs is possible for the result to be in the following format using a sql queryUserid A R2 2 13 1 0Thanks,JP |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-09-30 : 02:42:10
|
[code]SELECT UserID,SUM(CASE WHEN Status='A' THEN 1 ELSE 0 END) AS A,SUM(CASE WHEN Status='R' THEN 1 ELSE 0 END) AS RFROM YourTableGROUP BY UserID[/code] |
|
|
jai2808
Starting Member
27 Posts |
Posted - 2008-10-01 : 09:09:27
|
thanks visakh16 |
|
|
|
|
|