ORDER BY the SECOND word in a field
Posted 04 March 2006 - 11:42 PM
What is going to be my best way to sort my list? I looked through string manipulation in MYSQL, but I couldn't find a way to doa select statment that would search through my table, and pull all names based on the lastname.
SELECT * from catalog ORDER BY . . .
and here I want to say
"the first character after the first space in " FULLNAME
Posted 05 March 2006 - 01:10 AM
[a href=\"http://www.tech-recipes.com/mysql_tips484.html\" target=\"_blank\"]one page discussing regular expressions in MySQL selects[/a]
I'd highly recommend exporting the data, and re-importing it into two tables though, because it'll save you time down the road when any similar situations arise.
Posted 05 March 2006 - 01:38 AM
SELECT * from catalog ORDER BY SUBSTR(LTRIM(fullname), LOCATE(' ',LTRIM(fullname)))
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users