Need Urgent help on displaying Column values as Row Values

  • I have a table structure which has a trade id and multiple memotypes and memovalues associated with.

    tradenumber Memotype memovalue

    t1 mt1 mv1

    t1 mt2 mv2

    t1 mt3 mv3

    I wanted to display the columns like this

    tradenumber mt1 mv1 mt2 mv2 mt3 mv3

    Any idea is highly appreciated.

  • Any Help?

  • hi

    you can get help from PIVOT table .

    Please see below link

    http://msdn.microsoft.com/en-us/library/ms177410.aspx

    -------Bhuvnesh----------
    I work only to learn Sql Server...though my company pays me for getting their stuff done;-)

  • The Unpivot operator will do that. There are directions and examples in Books Online.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply