Chris Tate-Davies

An archive of helpful tit bits of information for development, and probably some stuff that is incomplete, wrong or boring…

MySQL – Order by certain value first

Ever wanted to sort a resultset of data, by value, but I wanted a couple of exceptions to appear at the top? SELECT country, population, CASE country WHEN ‘United Kingdom’ THEN 0 WHEN ‘United States’ THEN 1 WHEN ‘New Zealand” THEN 2 ELSE country END AS countrySort FROM countryList  ORDER BY countrySort ASC; This will [...]

  • Chris Tate-Davies

    Hello there. This is my little "repository" on the world wide web. Its for nothing more than documenting things that I might need again in the future. You could describe it as an extension to my memory.

    Also an online collaboration of my thoughts through the day. I'll try to keep the real random stuff out and keep the blog on course.

    Thanks for stopping by... Hope you find what you're looking for...

  • Tags