Crosstab help

  • How to make it crosstab query?

    From

    ID--Red--Yellow--Green

    AA--X

    AA----------X

    BB------------------X

    BB--X

    BB----------X

    To

    ID--Red--Yellow--Green

    AA--X-------X

    BB--X-------X-------X

  • Why cross tab if a simple aggregate works?

    SELECT ID,

    MAX(Red) AS Red,

    MAX(Yellow) AS Yellow,

    MAX(Green) AS Green

    FROM Sometable

    GROUP BY ID

    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
  • It works.

    Thanks

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

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