Results 1 to 3 of 3

Thread: SQL query doubt

  1. #1
    Join Date
    Oct 2003
    Posts
    51

    Unanswered: SQL query doubt

    SQL> select paytyperollup1,count(*) from paytype group by paytyperollup1

    PAYTYPEROLLUP1 COUNT(*)
    -------------------- ----------
    Neither 72
    Non-Productive 7
    Productive 4
    UNSPECIFIED 1

    I want the result like this,

    PAYTYPEROLLUP1 COUNT(*)
    -------------------- ----------
    PRoductive 76
    Non-Productive 8

    I want to combine Neither& Productive and Non-Productive&Unspecified. Is this possible.
    sampath gowri

  2. #2
    Join Date
    Aug 2004
    Location
    France
    Posts
    754
    This should work :
    Code:
    select decode(paytyperollup1, 'Neither', 'Productive', 'UNSPECIFIED', 'Non-Productive', paytyperollup1), count(*) 
    from paytype 
    group by decode(paytyperollup1, 'Neither', 'Productive', 'UNSPECIFIED', 'Non-Productive', paytyperollup1);
    It considers 'Neither' as 'Productive', 'UNSPECIFIED' as 'Non-Productive', and for other values, simply takes paytyperollup1.

    HTH & Regards,

    RBARAER

  3. #3
    Join Date
    Oct 2003
    Posts
    51
    Thank you.
    sampath gowri

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •