T-SQL Help

  • Hello

    I am stuck at one stage so i need help to resolve

    so please help me to do this

    CREATE TABLE #X1

    (vcEmployeeUniqueID VARCHAR(20),

    vcLastName VARCHAR(20),

    vcFirstName VARCHAR(20),

    iSchoolYearCode INT)

    INSERT INTO #X1 VALUES ('001210214','Miller','Helen',2009)

    INSERT INTO #X1 VALUES ('001210214','Miller','Helen',2010)

    INSERT INTO #X1 VALUES ('001210214','Miller','Helen',2011)

    INSERT INTO #X1 VALUES ('003215847','Carolyn','June',2010)

    INSERT INTO #X1 VALUES ('003215847','Carolyn','June',2011)

    INSERT INTO #X1 VALUES ('002149013','Steve','Ulman',2011)

    Desired output

    vcEmployeeUniqueIDvcLastNamevcFirstNameSY_2009SY_2010SY_2011

    001210214MillerHelen111

    003215847CarolynJune011

    002149013SteveUlman001

  • Read this article about pivot and cross tabs

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns[/url]

    Then come back if you have any questions.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

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

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