Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003
    Posts
    35

    Unanswered: Query: Nulls in Order By

    I have a query that I'd like to Order By Column 10 (which off-hand is a date). However, null values appear before non-null values. Is there anyway to keep Ascending order (that is earliest date to latest date) but putting Null values towards the bottom?

    Thanks

  2. #2
    Join Date
    May 2005
    Posts
    119
    Quote Originally Posted by tkchung
    I have a query that I'd like to Order By Column 10 (which off-hand is a date). However, null values appear before non-null values. Is there anyway to keep Ascending order (that is earliest date to latest date) but putting Null values towards the bottom?

    Thanks
    Here's what I like to do in this case. I add another column in the query with the expression of "sortcolumn:=iif(isnull([column 10]),1,0)".
    [If column 10 is null, then sortcolumn would be a 1. If there is a value, then 0. ]
    I sort by sortcolumn (ascending) first, and then by column 10 second. This should put the null values at the bottom.

    Hope this helps!
    Krista

Posting Permissions

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