Results 1 to 2 of 2

Thread: case/decode-all values

  1. #1
    Join Date
    Sep 2006
    Posts
    7

    case/decode-all values

    By using case statement and decode, I want to see all the options mentioned in case/decode even if it is zero.

    For eg.
    -------
    select decode(upper(group_id), 'W','White','B','Black','O','Orange','G','Green',' P','Pink','B','Blue'), count(*)
    from table_a
    group by group_id
    order by decode(upper(group_id), 'W','B','O','G','P','B')

    In this example, I would like to see the count of all the colors even if it zero. Similarly for case also.

    Output:
    -------
    White 567
    Black 0
    Orange 384
    Green 894
    Pink 0
    Blue 83

    Thanks in advance.

    Sathya

  2. #2
    Join Date
    Sep 2006
    Posts
    7
    Can anyone help me out to solve this issue,please?

Posting Permissions

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