How to get Desired Out Put Like

  • Hi,

    Below is the My Table data...

    TypeUser Name region duration1duration2dailsMathSilverGold

    ARamesh Section01 892 1742 40 1 3103

    BNaresh Section01 0 0 0 0 08

    BSingh Section01 0 3003 120 0 226

    BKanth Section01 359 1261 52 1 013

    BPeter Section01 1716 3230 173 0 128

    Total Section01-Total 2967 9236 385 1 3103

    Above From Duration1(Calculating type of A+B),Duration2(Calculating type of A+B),Dials(Calculating Type of A+B)

    But Math,Silver,Gold I need to Calculate of Type A.

    I need to get The Total Like above out put.

    Help me,

    Thanks

  • Try this..

    Select sum(Duration1) as Duration1,Sum(Duration2)as Duration2,

    Sum(Duration3) as Duration3, Case When Type = A then Math END as Math, Case When Type = A then Silver END as Silver

    From Table

    where Type in ('A','B')

    Thanks,
    Chinna

    Its the Journey which gives you Happiness not the Destination-- Dan Millman

  • suresh0534 (2/17/2015)


    Hi,

    Below is the My Table data...

    TypeUser Name region duration1duration2dailsMathSilverGold

    ARamesh Section01 892 1742 40 1 3103

    BNaresh Section01 0 0 0 0 08

    BSingh Section01 0 3003 120 0 226

    BKanth Section01 359 1261 52 1 013

    BPeter Section01 1716 3230 173 0 128

    Total Section01-Total 2967 9236 385 1 3103

    Above From Duration1(Calculating type of A+B),Duration2(Calculating type of A+B),Dials(Calculating Type of A+B)

    But Math,Silver,Gold I need to Calculate of Type A.

    I need to get The Total Like above out put.

    Help me,

    Thanks

    Just a suggestion... It took almost a week before someone responded to your problem. Please see the first link under "Helpful Links" in my signature line below for what the problem may have been and how to solve it in the future.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

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

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