8 messages in com.mysql.lists.mysqlRE: complicated query| From | Sent On | Attachments |
|---|---|---|
| Jeff Shipman - SysProg | 20 Apr 2001 11:38 | |
| Braxton Robbason | 20 Apr 2001 12:15 | |
| Steve Werby | 20 Apr 2001 12:39 | |
| Rick Pasotto | 20 Apr 2001 13:13 | |
| Jeff Shipman - SysProg | 20 Apr 2001 14:09 | |
| Jeff Shipman - SysProg | 20 Apr 2001 14:12 | |
| Rick Pasotto | 20 Apr 2001 14:37 | |
| Milo Stefani | 23 Apr 2001 00:31 |
| Subject: | RE: complicated query![]() |
|---|---|
| From: | Jeff Shipman - SysProg (je...@nmt.edu) |
| Date: | 04/20/2001 02:12:09 PM |
| List: | com.mysql.lists.mysql |
This does not work for me. It returns syntax errors.
Jeff Shipman E-Mail: je...@nmt.edu Systems Programmer Phone: (505) 835-5748 NMIMT Computer Center http://www.nmt.edu/~jeff
On Fri, 20 Apr 2001, Braxton Robbason wrote:
} 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:je...@nmt.edu] } Sent: Friday, April 20, 2001 2:39 PM } To: mys...@lists.mysql.com } 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: je...@nmt.edu } 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 <mysq...@lists.mysql.com> } To unsubscribe, e-mail } <mysql-unsubscribe-robbason=buzz...@lists.mysql.com> } 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 <mysq...@lists.mysql.com> } To unsubscribe, e-mail <mysql-unsubscribe-jeff=nmt....@lists.mysql.com> } Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php }




