asked on
ASKER
MySQL is an open source, relational database management system that runs as a server providing multi-user access to a number of databases. Acquired by Oracle in 2009, it is frequently used in combination with PHP installations, powering most of the WordPress installations.
TRUSTED BY
I am not sure you want/need regular expressions in this instance. You should be able to use some simple string functions http://dev.mysql.com/doc/refman/4.1/en/string-functions.html here to achieve what you need.
SELECT fullname
FROM users
ORDER BY LEFT(fullname, INSTR(fullname, ',')-1)
If you have rows that may not have a comma, then you can wrap with IF or CASE statement to display/sort by full string value otherwise split on the comma.