Alternatively you can create a priority column defaulting to one number (99) this will allow you to easily change the country sequence as needed. SELECT countries_id, countries_name FROM TABLE_COUNTRIES ORDER BY priority,countries_name;
I hope this helps... Pat... [EMAIL PROTECTED] CocoNet Corporation SW Florida's First ISP ----- Original Message ----- From: "Don Read" <[EMAIL PROTECTED]> To: "Ralph" <[EMAIL PROTECTED]> Cc: "mySQL Mailing List" <[EMAIL PROTECTED]> Sent: Wednesday, June 25, 2003 4:38 AM Subject: Re: Sorting Countries > > 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] > -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]