Web Hosting Talk







View Full Version : mysql non-existant select


variable
07-11-2005, 11:44 PM
i have a field called important, and it should list any rows that contain the important tag first so i have it setup to select important, but then i want it to list any topics that dont have important, how can i do this?

important!=1
!important
important=0

none of those work, so i dont what to do next.

how do you do this, i cannot seem to find it through google either.

variable
07-12-2005, 02:08 AM
this is in the mysql_query(); too if that wanst implied

sojish
07-12-2005, 02:32 AM
Just give 2-3 lines of your php code containing the specific part so that we'll understand your question better.

hiryuu
07-12-2005, 02:35 AM
You can ORDER BY any value, including, if so inclined, constants and boolean equations. You probably want something like

ORDER BY important = 1, itemID LIMIT x

Note that this requires pulling the full select result to sort it, so make sure your WHERE clauses reduce the result set to something sane.

variable
07-12-2005, 02:51 AM
well i am already ordering by time, can i order by both? important first, then time?

laserlight
07-12-2005, 03:39 AM
Yes.
ORDER BY col1 DESC, col2;
would order by col1 in descending order, then order by col2.

variable
07-12-2005, 01:45 PM
thanks, got it working with that