[thelist] mysql regular expression query
kris burford
thelist at lists.evolt.org
Tue Nov 12 05:23:01 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