how to change column data to rowdata in and how to count the data

  • 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

  • Do a quick search at SSC (search function is to the upper right) and you will find plenty of examples of how to handle this. The key terms to search on are PIVOT and CROSSTAB. Please let us know if you have any questions.

    __________________________________________________

    Against stupidity the gods themselves contend in vain. -- Friedrich Schiller
    Stop, children, what's that sound? Everybody look what's going down. -- Stephen Stills

  • Please post here: http://www.sqlservercentral.com/Forums/Topic787173-338-1.aspx

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

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