MySQL Ordering Results

Say you want to sort your query results in a specific predefined order. Just add the following to your query:

ORDER BY FIELD(column, ‘first thing’, ‘second thing’, ‘next thing’, ‘last thing’)

Unfortunately, if there are other unknown entries in `column`, they will be sorted ABOVE your predefined list. The solution is to reverse your list and add the DESC parameter as such:

ORDER BY FIELD(column, ‘last thing’, ‘next thing’, ‘second thing’, ‘first thing’), DESC

Also be sure there is no space between FIELD and ( or MySQL will give an error about FIELD not being in your table.

What Version of Linux am I Running

Seems like a silly question, but if you’re on a remote host, you probably wouldn’t know the answer. Here’s the command:

uname -a && cat /etc/*release

Mobile blogging

Testing out the iPhone wordpress app for mobile publishing :)

Hello World

Hi there… Just got the site back up and running :)