Ordering dates DESC but with NULLS FIRST?

Results 1 to 3 of 3

Thread: Ordering dates DESC but with NULLS FIRST?

  1. #1
    Join Date
    Dec 1969
    Posts
    158

    Default Ordering dates DESC but with NULLS FIRST?

    Hi. Is there an easy way to do a select query that returns some dates, ordered by descending, but with any null dates first instead of last? I know I could do that as two separate calls, but I&#039;d rather avoid that.<BR><BR>Thanks!<BR>Corey

  2. #2
    Join Date
    Dec 1969
    Posts
    2,437

    Default Yes

    select * from ogrish <BR>order by case <BR> when dateColumn is null then 0<BR> else 1 end,<BR> datecolumn desc

  3. #3
    Join Date
    Dec 1969
    Posts
    158

    Default Thanks!

    That&#039;s just the trick!<BR><BR>Thanks!<BR>Corey

Posting Permissions

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