On Sun, 3 Feb 2002, Chuck Barnett wrote:
>  I have a db field that holds the first and last name of a person.  Is
> there a way to sort by the last name in that field?
> The whole reason for this is to populate a select box sorted by last name.
> I don't want to go back and create a separate field if I don't have to.

You can do something cheesy like this:

  select name from table order by substring(name, locate(' ', name))

but really I'd advise splitting it into separate fields because your 
queries will run faster and you'll have more flexibility in the long term.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to