Sep 27, 2006 #1 Actorial Programmer Aug 23, 2006 38 US Hi, I'm wondering if I can sort by multiple categories in different directions. I tried this and it doesn't work: Code: SELECT * FROM table ORDER BY field1 DESC ORDER BY field2 ASC LIMIT 0,10 And it doesn't work, any advice?
Hi, I'm wondering if I can sort by multiple categories in different directions. I tried this and it doesn't work: Code: SELECT * FROM table ORDER BY field1 DESC ORDER BY field2 ASC LIMIT 0,10 And it doesn't work, any advice?
Sep 27, 2006 Thread starter #2 Actorial Programmer Aug 23, 2006 38 US nevermind, i solved my own prblem, just was missing commmas after each ASC or DESC! Upvote 0 Downvote
Sep 29, 2006 #3 guelphdad Technical User Sep 19, 2004 283 CA you can't have two separate order by clauses in there of course, just the list of the columns and as you say separated by a comma. Code: select foo, bar from yourtable order by foo asc, bar desc and to save a few keystrokes ascending is the default so you don't have to note that. Upvote 0 Downvote
you can't have two separate order by clauses in there of course, just the list of the columns and as you say separated by a comma. Code: select foo, bar from yourtable order by foo asc, bar desc and to save a few keystrokes ascending is the default so you don't have to note that.