[thelist] mysql regular expression query
kris burford
kris at midtempo.net
Tue Nov 12 05:23:01 CST 2002
>I have a column in a mysql table with a name of a person, say "Franklin D.
>Roosvelt". Can I
>query the table so that the name will be retrieved in the following format:
>
>Roosvelt, Franklin D.
>
>Any help will be appreciated.
>
>--Kevin
hi kevin,
i am not aware of any means by which to do this in mysql alone (although
i'm not a mysql guru by any means!). however, are you using a scripting
language such as php alongside mysql? if so, it's a relatively simple
matter to return the query from the database and then manipulate the result
using preg_split (see http://www.php.net/manual/en/function.preg-split.php).
alternatively, you might wish to return to your mysql table and include
another column so that you're starting with separate first name and surnames.
hth
kris
More information about the thelist
mailing list