Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2004
    Posts
    6

    Unanswered: How to sort NULLS

    Hi All,

    I have a table with 3 columns. Product, Location and Value. The data looks like this:

    NULL NULL 100
    Atlanta NULL 50
    Atlanta Cookie1 30
    Atlanta Cookie2 20
    Dallas NULL 120
    Dallas Cookie1 80
    Dallas Cookie2 40

    This table gets filled with a Groupby with Rollup option. The NULLS show subtotals/total. Is there a way to build a query that returns the results with NULLs at the bottom of each section like:


    Atlanta Cookie1 30
    Atlanta Cookie2 20
    Atlanta NULL 50
    Dallas Cookie1 80
    Dallas Cookie2 40
    Dallas NULL 120
    NULL NULL 100

    Thanks,

    Shab

  2. #2
    Join Date
    Jun 2003
    Location
    Ohio
    Posts
    12,592
    Provided Answers: 1
    Order by ISNULL(Product, 'ZZZ'), ISNULL(Location, 'ZZZ')
    If it's not practically useful, then it's practically useless.

    blindman
    www.chess.com: "sqlblindman"
    www.LobsterShot.blogspot.com

  3. #3
    Join Date
    Feb 2004
    Location
    Poland
    Posts
    96
    if you get the result with order by, try without it

Posting Permissions

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