RE: [PHP] sorting data from a field
| From: | Rick Emery | Date: | Tue, 26 Mar 2002 21:25:50 +0000 |
| Subject: | RE: [PHP] sorting data from a field | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-90275@lists.php.net to get a copy of this message | ||
you can extract and sort on the last name:
mysql> select substring(myname,locate(" ",myname)+1) as lname from mytable
order by lname;
this assumes names are stored as "john doe", that is with a space separator
-----Original Message-----
From: Chuck Barnett [mailto:art_info@bellsouth.net]
Sent: Sunday, February 03, 2002 2:50 PM
To: PHP General List
Subject: [PHP] sorting data from a field
Hello again :)
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.
Any help is appreciated.
Thanks,
Chuck
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php