PDA

View Full Version : ORDER BY Question


MUG
Thu 8th May '03, 5:08pm
SELECT threadid, title, lastpost, lastpostid, lastposter, lastposterid, replycount, postusername, status FROM thread WHERE forumid=1 AND NOT(status & 4) ORDER BY (status & 1) DESC, lastpost DESC LIMIT 0,15

Would the bold part work with MySQL 3? I only have a machine running MySQL 4.

Chen
Thu 8th May '03, 5:11pm
I don't think so, you should select (status & 1) as a column in the SELECT clause then use that name in the ORDER BY clause.

MUG
Thu 8th May '03, 5:24pm
Thanks. :)