"David Freeman" <[EMAIL PROTECTED]> wrote: > SELECT * FROM My_Table ORDER BY Business_Name, Last_Name, First_Name; > > What I would _like_ to have happen is that the select list will end up > sorted by business name as well as last name and then first name. At > the moment this query is resulting in all business names (sorted) and > then, following all business names, all last/first names (also sorted). > > I want them all integrated into a single alphabetical list.
This is really an SQL question so the MySQL mailing list would have been a better place to ask, but... You need to do an IF() to check whether to use Business_Name or a combo of Last_Name/First_Name, then you need to join Last_Name/First_Name if Business_Name is empty and name the column something and order by that column. SELECT IF( Business_Name<>'', 'Business_Name', CONCAT( Last_Name, ', ', First_Name ) ) AS mylist FROM My_Table ORDER BY mylist -- Steve Werby President, Befriend Internet Services LLC http://www.befriend.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]