How can i get this output ??

  • [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

  • 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