I'm mildly familiar with MySQL queries, but I've got one tricky thing that I can't figure out how to do. Is there a way to tell the system "anything matching X-condition first, otherwise order normally." For example, in a table
posts with the fields
(post_id, author_id, timestamp) I know how to do...
mysql_query("SELECT * FROM posts ORDER BY timestamp");
But is there a way to have a certain user's posts (say,
author_id = 5) show up at the top of the results, and then sort by timestamp after that? To be clear: I DON'T want to sort by
author_id, I just want to isolate the posts where
author_id is 5 specifically, and then sort by
timestamp for everything else.
Is there a way to do that? I've tried,
mysql_query("SELECT * FROM posts ORDER BY author_id = 5, timestamp");
...but it doesn't seem to work.