Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
order by ASC with blanks last
Old 05-11-2006, 12:29 PM order by ASC with blanks last
Experienced Talker

Posts: 48
Trades: 0
ive got an ASPX web page accessing an MS ACCESS backend.

i need to retrieve a list of books buy catagory in alphabetical order.

ok simply.

"....order by catagory ASC"

However some books do not belong to a catagory. therfore they appear at the top of the list b4 the "A"s.

i want them to appear at the end of the list, after the ZZZZZs.

is there an SQL ORDER command that puts blanks at the end of a ASC list????

im sure ive heard of this! but cant remember the command!

====================================

No i dont want to use DESC
__________________
regards,

Pauly.
The true sign of intelligence is not knowledge but imagination. (Albert Einstein)
Be who you are and say what you feel,
because those who mind don't matter and those who matter don't mind. (Dr. Seuss
)
paulwebmaster is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-12-2006, 02:15 AM Re: order by ASC with blanks last
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
Are you using join? Show your sql query.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 05-12-2006, 06:42 AM Re: order by ASC with blanks last
Experienced Talker

Posts: 48
Trades: 0
no im not using a join. what has a join got to do with it?

lets just pretend im doing select * from table1 order by row1.

i still want asc sorting with blanks at the end!!!!! time waster!!!!!!
__________________
regards,

Pauly.
The true sign of intelligence is not knowledge but imagination. (Albert Einstein)
Be who you are and say what you feel,
because those who mind don't matter and those who matter don't mind. (Dr. Seuss
)
paulwebmaster is offline
Reply With Quote
View Public Profile
 
Old 05-12-2006, 07:40 AM Re: order by ASC with blanks last
mtishetsky's Avatar
King Spam Talker

Posts: 1,226
Name: Mike
Location: Mataro, Spain
Trades: 0
You won't be able to place blanks after Zs because it's natural order is before As. If you need them after Zs you have to put them there within script.
__________________

Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE
-
Please login or register to view this content. Registration is FREE

And don't forget to give me talkupation!
mtishetsky is offline
Reply With Quote
View Public Profile Visit mtishetsky's homepage!
 
Old 05-12-2006, 11:02 AM Re: order by ASC with blanks last
Minaki's Avatar
Defies a Status

Posts: 1,626
Location: Guildford, UK
Trades: 0
I managed to do something with UNION ALL to get the nulls grouped at the end of the query, however it wasn't possible to sort the ones that were not null...
__________________
Minaki Serinde MCP
"Wow, Linux is nearly on-par with Windows ME!"

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Minaki is offline
Reply With Quote
View Public Profile Visit Minaki's homepage!
 
Old 05-12-2006, 04:58 PM Re: order by ASC with blanks last
etech355's Avatar
Average Talker

Posts: 29
Location: Maryland
Trades: 0
You may be to use a case statement to replace nothing with something.

select case category when '' then 'unknown' end as category from table order by category asc
__________________
Eric

Please login or register to view this content. Registration is FREE
etech355 is offline
Reply With Quote
View Public Profile Visit etech355's homepage!
 
Old 05-15-2006, 09:31 AM Re: order by ASC with blanks last
Experienced Talker

Posts: 48
Trades: 0
thanks etech355, guys,

i think ill change nulls to zzz and get around it that way.



buy the way, any one interested might like to know that in oracle you can say:

order by XXXXX DESC NULLS LAST (or NULLS FIRST).
shame you cant do this in MS ACCESS.

thanks guys.
__________________
regards,

Pauly.
The true sign of intelligence is not knowledge but imagination. (Albert Einstein)
Be who you are and say what you feel,
because those who mind don't matter and those who matter don't mind. (Dr. Seuss
)
paulwebmaster is offline
Reply With Quote
View Public Profile
 
Old 05-15-2006, 11:27 AM Re: order by ASC with blanks last
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,898
Name: Keith Marshall
Location: Connecticut
Trades: 0
Quote:
order by XXXXX DESC NULLS LAST (or NULLS FIRST).

Thats cool!
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is online now
Reply With Quote
View Public Profile
 
Old 05-15-2006, 03:58 PM Re: order by ASC with blanks last
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,519
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
A union query will do what you want (if access supports UNION ) but the only way I can think of to make it work would be 26 UNION statements with wildcards from a to z

PHP Code:
select fieldlist from table where cat_field like "a%" 
union
select fieldlist from table where cat_field like 
"b%" 
union
select fieldlist  from table where cat_field 
"" 
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to order by ASC with blanks last
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB 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.28737 seconds with 12 queries