Mahesh Bote
SSCrazy Eights
Points: 9107
More actions
April 10, 2010 at 5:03 am
#1149544
[font="Verdana"]
try this
Selectid
,USD = (Case When Curre = 'usd' Then Rate Else 0 End)
,INR = (Case When Curre = 'inr' Then Rate Else 0 End)
FromTable
--Mahesh
[/font]
MH-09-AM-8694
Arshad Kalam
SSC Enthusiast
Points: 109
April 12, 2010 at 6:02 am
#1149950
You can also use PIVOT operator. Here is the example
select id, USD = ISNull([USD], 0), IND = IsNull([IND], 0)
From
(
Select id, Curr, rate
from Table
) AS Tb
Pivot
Sum(Rate)
For Curr in ([USD], [IND])
) As Pv
Viewing 2 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply