On 25-Jun-2003 Ralph wrote:
> I am getting a list of all countries from database, and then I am
> sorting by country name. However since most orders will be from US I
> want the US to appear first over the rest of the countries. How can I go
> about doing this?
> 
> Currently, this is my query:
> 
> SELECT countries_id, countries_name FROM TABLE_COUNTRIES ORDER BY
> countries_name;

"SELECT IF(countries_id='US', 0, 1) as ctsort, countries_id, countries_name
  FROM TABLE_COUNTRIES 
  ORDER BY ctsort, countries_name"

Regards,
-- 
Don Read                                     [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to 
   steal the neighbor's newspaper, that's the time to do it.
                            (53kr33t w0rdz: sql table query)


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to