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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 help query

Author  Topic 

learntsql

524 Posts

Posted - 2009-07-08 : 08:16:47
Hi all,
i have my data as folloes

Status Stage1 stage2
A 1 0
B 2 1
C 1 0
D 1 1
Now i want my output like
Stage1 ACCEPTED Denied Stage2 Accepted denied
4 3 2 2 1 1

note: status 'C' for Denied

please tell me.
Thanx.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-08 : 08:19:34
are you using SQL 2005 ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

learntsql

524 Posts

Posted - 2009-07-08 : 08:35:57
yes
i am using sql 2005.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-08 : 08:44:27
Check BOL on PIVOT operator


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

learntsql

524 Posts

Posted - 2009-07-08 : 09:19:17
I already did PIVOT and the above data is the result of that only and if again do will it affect on performance.
can you please tell me the solution.
thanks.
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2009-07-08 : 09:31:28
you mean the above is a result of PIVOT ? then can you post the original table structure and the corresponding sample data ?


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page

learntsql

524 Posts

Posted - 2009-07-08 : 09:49:26
Thanx khtan,
sorry i couldnt send sample data.
but I got solution when i again do pivot on existing pivot.
Could you please tell the performance impact in above schenario.
Thanks.
Go to Top of Page
   

- Advertisement -