From: Peter Brawley Date: June 5 2007 9:58pm Subject: Re: Sorting by a list of possible results in a column.... List-Archive: http://lists.mysql.com/mysql/207257 Message-Id: <4665DC9D.5090808@earthlink.net> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Mike >I have a query that selects a list of results, ordering them by the status >field. However, I want to further sort that by the type of status, that is: >Undefined >Ready for Review >Top Priority >Priority >Completed ORDER BY FIELD( columnname, 'Undefined', 'Ready for Review', ... ) PB Mike Morton wrote: > I am sure that this has been asked - but in searching through google and > lists for about an hour - hopefully someone will indulge me a repeat > question here. > > I have a query that selects a list of results, ordering them by the status > field. However, I want to further sort that by the type of status, that is: > > Undefined > Ready for Review > Top Priority > Priority > Completed > Etc... > > Every sort that I try, of course, sorts alphabetically. Is there a way to > define how the sort function works in the order by? > > I know that I could do this in PHP after populating the results into an > array, but that is (in my opinion) an unnecessary step that could be handled > at the database query.... > > Thanks! > > Sample query: > Select * from development order by status > > >