SSRS Matrix - Transpose row to colums in desert way

  • Hello,

    Firstly apologies if this turns out to be a t-sql issue but as it is a report I am trying to produce I have put it in this forum.

    I have been asked to provide a report. Currently the data returns as 1 row per CourseCode.

    StudentID, StudentName, CourseCode

    1111, Ihsan, AGH001

    1111, Ihsan, KOM201

    1212, Rivo, KOM202

    1222, Lugas, AGH001

    1222, Lugas, KOM201

    1222, Lugas, KOM202

    I need to be able to present the data in the following way (a column for each CourseCode against a membership number):

    StudentID,StudentName, Course1,Course2,Course3,Course4,Course5

    1111, Ihsan, AGH001, KOM201

    1212, Rivo, KOM202

    1222, Lugas, AGH001, KOM201, KOM202

    The problem I am facing is the number of CourcesCode is an unknown figure so the report will need to create the columns dynamically, I initially thought a matrix would solve this but either the grouping wonโ€™t work in this scenario or I am going about it in the wrong way

    Is it possible to do this using pivot query/matrix table or does the data need to be built up so that the report becomes a simple select from a temporary table?

    Thanks

  • I think this will help you, please gone through the link.

    http://stackoverflow.com/questions/19688697/mssql-dynamic-pivot-column-values-to-column-header

  • Sreepathi1987 (1/18/2015)


    I think this will help you, please gone through the link.

    http://stackoverflow.com/questions/19688697/mssql-dynamic-pivot-column-values-to-column-header%5B/quote%5D

    Thank you for your help.. Now I do it for SQL ๐Ÿ˜€

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

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