assunming that the filed is named names select *,substring_index(names, ' ', -1) as last order by last
will return a field with the last name in it attached to the table ordered by this great great field. anyway chack the syntax hth ----- Original Message ----- From: Wade Smart To: [email protected] Sent: Tuesday, January 29, 2008 4:03 AM Subject: Re: [php_mysql] Sort by Last name Mark Wheeler wrote: > Hi, > > Just a quick question. Is it possible to sort a table by last name > when the first and last name are in the same field? For example, if I > had to sort the following by last name: > > Jim Berg > Ray Shwartz > Al Peking > Nick Cutter > > How would, if it can, be done within the query? Again, each field has > the first and last name in it. > > Thanks, > > Mark 01282008 2003 GMT-6 You cant sort the table but, if you pull the data and separate it out, you could then sort by last name. Wade __________ NOD32 2830 (20080129) Information __________ This message was checked by NOD32 antivirus system. http://www.eset.com [Non-text portions of this message have been removed]
