Hi, I'm trying to create a mysql query that will order by one type and then order the results after by another. The purpose is to get the sticked forum topics and show these in order before then showing the rest of the unsticked forum topics in numerical order. I've tried the following with no luck: SELECT * FROM forumPosts ORDER BY sticky DESC ORDER BY id DESC SELECT * FROM forumPosts ORDER BY sticky DESC id DESC PHP: Thanks in advance
This question is semi related to the original post but can anyone tell me why an Order by Clause might sort incorrectly with 3 parameters? $query="SELECT * FROM misc ORDER BY eYear, eMonth, eDay DESC"; i run that query and it refuses to sort the months in DESC fashion they display in ASC, however the Year is in DESC. all values in the database are numeric 01-99 the year of course being 0000 format
Try, replace the two ASC with DESC if you need, $query="SELECT * FROM misc ORDER BY eYear ASC, eMonth ASC, eDay DESC"; PHP:
Awesome, that worked like a charm! I was smacking myself in the forehead thinking why I hadn't tried that yet. Thanks!