xyn Posted November 12, 2006 Share Posted November 12, 2006 Hey,I have a case script in SQL so that NEW private Messagesare always ordered at the top, then everything else which isread are listed under-neath, but the problem with this iseverything is NOT in date order, which is confusing me...I basically wanted new messages at the top in order of DATE descending. but everything else under that is randomlyordered...my code:SELECT id,fr_usr,subject,stats,date,time,CASE WHEN stats='3' THEN 1 WHEN stats='0' THEN 2 ELSE 3 END as pmsort FROM pmWHERE to_usr='{$_SESSION['username']['usr_user']}' ORDER BY pmsort,date DESCAny ideas? Quote Link to comment Share on other sites More sharing options...
fenway Posted November 12, 2006 Share Posted November 12, 2006 Well, it won't be in date order, since date is your second order by criterion. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.