Created
February 20, 2018 12:37
-
-
Save SuN-80/7dae3ede7507f8e8a5236ef1586eecfc to your computer and use it in GitHub Desktop.
Flip First and Last Names in MySQL
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- "Lastname, Firstname" to "Firstname Lastname" | |
UPDATE mytable set field = CONCAT( | |
TRIM(SUBSTRING_INDEX(SUBSTRING_INDEX(field,',',2),',',-1)), | |
' ', | |
TRIM(SUBSTRING_INDEX(field,',',1)) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment