How to order with count value=0
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 4 of 4

Thread: How to order with count value=0

  1. #1
    Join Date
    Mar 2004
    Posts
    55

    Question How to order with count value=0

    I have written a simple query that involves a count and outer join.

    To get around the nulls an outer join may produce, i have used nvls(column,) so that nulls are replaced by 0

    I wish now to order my records ascending by the count from 0 to infinity however I have found that 0 is considered to be order last

    Eg

    Region Count
    B 1
    C 5
    D 7
    A 0

    How can i get it to return

    Region Count
    B 0
    C 1
    D 5
    A 7


    Is there a mask or something. Using to_number did not work and to_char is also not practical if your count is two digit number.


    Thanks

  2. #2
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

  3. #3
    Join Date
    Mar 2004
    Posts
    55
    Thanks

    [ NULLS FIRST | NULLS LAST ]

  4. #4
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

Posting Permissions

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



Click Here to Expand Forum to Full Width