Transposing two rows of data to one row

  • SELECT DocumentNo_,

    MAX(CASE WHEN DimensionCode='DEPARTMENT' THEN DimensionValueCode END) AS DimensionValueCode_1,

    MAX(CASE WHEN DimensionCode='TRADETYPE' THEN DimensionValueCode END) AS DimensionValueCode_2

    FROM myTable

    GROUP BY DocumentNo_

    ____________________________________________________

    Deja View - The strange feeling that somewhere, sometime you've optimised this query before

    How to get the best help on a forum

    http://www.sqlservercentral.com/articles/Best+Practices/61537
  • Thank you very much for your help.

    I have tested the code and It worked .

    Thank you,

    Alan

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

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