Reply
Sort by ASC and (null)?
Old 06-19-2007, 11:57 AM Sort by ASC and (null)?
Skilled Talker

Posts: 59
Name: Nick Martin
Hey Everyone!

Wondering if this is even possible. I have a table with 2 columns (WO# , SchedFinish) I am ordering by SchedFinish ASC. However some of the SchedFinish values are null. I would like them at to fall after the non-null values. Is this possible.

SELECT WO, SchedFinish FROM "work"
ORDER BY SchedFinish ASC

So this is basically what I have. Can this be modified to sort the null values to the end?
SpudNik is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 06-19-2007, 12:07 PM Re: Sort by ASC and (null)?
Learning Newbie's Avatar
Moderator

Latest Blog Post:
What’s He Looking At?
Posts: 4,983
Name: John Alexander
ORDER BY IsNull(SomeField, 'zzzzzzzzzzzzzzzzzz')

Also, you don't need to specify ASC in the sort, because that's the default. You need to put DESC to override the default, but ASC is assumed.
__________________
4 ways to improve the lives of the "bottom billion"

"HEY YOU KIDS GET OFF MY LAWN!" -John McCain
Learning Newbie is offline
Reply With Quote
View Public Profile
 
Old 06-21-2007, 03:33 PM Re: Sort by ASC and (null)?
chrishirst's Avatar
Super Moderator

Posts: 12,792
Location: Blackpool. UK
Code:
SELECT WO, SchedFinish FROM "work" ORDER BY NOT IsNull(SchedFinish) DESC, SchedFinish [ASC];
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
Indifference will be the downfall of mankind, but who cares?
Code Samples | People Counting System
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to Sort by ASC and (null)?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.15416 seconds with 13 queries