how to change rows to columns

  • i have a tables like :

    this table have the columns:

    -----------------------------------

    prioriy table

    pid name

    ---------------

    1 critical

    2 major

    3 minor

    status table

    ----------------

    1 new

    2 open

    3 closed

    4 draft

    product table

    -----------------

    id(auto_increment) title priority status

    -------------------------------------------------------------

    100 a 1 1

    101 a 2 1

    102 a 3 1

    104 a 1 2

    105 a 2 2

    104 a 3 2

    105 a 1 3

    106 a 2 3

    107 a 3 3

    108 a 1 4

    109 a 2 4

    110 a 3 4

    111 a 3 4

    i need this type of out put :

    ----------------------------------

    id title pirority new open closed draft

    ----------------------------------------------------------------------------

    1 a 1 1 1 1 1 -----

    1 a 2 1 1 1 1 ---

    1 a 3 1 1 1 2 ---- these are

    count of stauses

    ... Please help me on this ...................

    Thanks
    Dastagiri.D

  • Hi,

    Second time this query posted,

    Dastagiri, mention your problem in

    http://www.sqlservercentral.com/Forums/Topic787173-338-1.aspx

    So that, will understand your issue better.

  • This is now the 7th time you've posted this same thing. What's the deal? Beyond the repeated posting, you've been around long enough to know that the way you posted that data doesn't do much for us. Instead of repeatedly spamming the same weak post over and over, spend that time to construct the question in a proper manner and we'd be happy to help you.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • Let's try to keep this consolidated. Arun has already posted some code in this thread. Any replies here please.

    http://www.sqlservercentral.com/Forums/Topic787173-338-1.aspx

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • Would you mind sharing the reason for posting a request again and again that has been resolved two days ago????

    You obviously didn't even take the time to look at arun's solution nor did you make any comment whether it meets your requirement or not.

    I don't care if you're wasting your time doing double and triple posts. But I do care if you're wasting my time asking questions over and over again ignoring the answers you already have. This behavior leaves the impression that you're not interested in an answer but in consuming our time. Not a professional way to communicate if you're asking me...



    Lutz
    A pessimist is an optimist with experience.

    How to get fast answers to your question[/url]
    How to post performance related questions[/url]
    Links for Tally Table [/url] , Cross Tabs [/url] and Dynamic Cross Tabs [/url], Delimited Split Function[/url]

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

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