you want a function that prepends the letter a to the category/subcategory
names that are not other. then you order by that function, but do not
display it.
select category,subcategory from foo2
order by if(category=
'other','zz',concat('a',category));
i.e. everything except other begins with an a as far as the order by is
concerned, while other is zz for sorting purposes.
-----Original Message-----
From: Jeff Shipman - SysProg [mailto:[EMAIL PROTECTED]]
Sent: Friday, April 20, 2001 2:39 PM
To: [EMAIL PROTECTED]
Subject: complicated query
I would like to do something similar to an ORDER BY
in one of my select statements, but I'mt not sure
how to do something as complicated as this:
I have two columns, category and subcategory, that
I am retrieving. I would like category and subcategory
to be sorted alphabetically. This is easy with an
'ORDER BY 1 2', but I would like categories that
are named 'other' to be put off until the end. So,
I'd get something like this:
abcd
ghikj
zzzzz
other
Is there a way to do this type of query? Thanks in
advance.
Jeff Shipman E-Mail: [EMAIL PROTECTED]
Systems Programmer Phone: (505) 835-5748
NMIMT Computer Center http://www.nmt.edu/~jeff
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail
<[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php