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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2007-01-08 : 08:00:15
|
| Madhavi writes "hello sir,select p.name as hospital,'accepted'=case when pr.preauthstatus=1 then count(pr.preauthstatus) end ,'pending'=case when pr.preauthstatus=2 then count(pr.preauthstatus) end,'rejected'=case when pr.preauthstatus=3 then count(pr.preauthstatus) end,'Total'=count(pr.preauthstatus)from preauthorization pr,provider pwhere p.id=pr.providerid group by p.name,pr.preauthstatus ORDER BY p.name hospitalname accepted pending rejectedAsian Heart Institute 134 NULL NULL 134Asian Heart Institute NULL NULL 4 4Balaji Hospital 61 NULL NULL 61Balaji Hospital NULL 1 NULL 1Balaji Hospital NULL NULL 1 1Bombay Hospital 298 NULL NULL 298Bombay Hospital NULL 6 NULL 6Bombay Hospital NULL NULL 56 56BSES MGH Hospital 26 NULL NULL 26BSES MGH Hospital NULL 1 NULL 1BSES MGH Hospital NULL NULL 1 1Cumballa Hill Hospital 29 NULL NULL 29Cumballa Hill Hospital NULL NULL 2 2Godrej Hospital 28 NULL NULL 28Godrej Hospital NULL NULL 2 2Gurunanak Hospital (Bandra) 102 NULL NULL 102Gurunanak Hospital (Bandra) NULL 7 NULL 7Gurunanak Hospital (Bandra) NULL NULL 20 20Inlaks General Hospital 95 NULL NULL 95Inlaks General Hospital NULL NULL 3 3Joy Hospital 41 NULL NULL 41Joy Hospital NULL NULL 5 5Life Line Hospital 224 NULL NULL 224Life Line Hospital NULL 1 NULL 1Life Line Hospital NULL NULL 3 3Sushrut Hospital 95 NULL NULL 95Sushrut Hospital NULL NULL 10 10Tata Memorial Hospital 3 NULL NULL 3Tata Memorial Hospital NULL 1 NULL 1Wockhardt Hospital (Mumbai) 188 NULL NULL 188Wockhardt Hospital (Mumbai) NULL 6 NULL 6Wockhardt Hospital (Mumbai) NULL NULL 22 22But i want providername only once in query and corresponding count of preauths .In this query,i'm getting values in different lines.Thanks in advance." |
|
|
|
|
|