Created
February 26, 2015 17:09
-
-
Save anaxamaxan/b5298a8455339f879b3c to your computer and use it in GitHub Desktop.
small tweak for tessa
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
UPDATE `tbl_name` SET | |
`first_name` = IF( | |
LOCATE(' ', `name`) > 0, | |
SUBSTRING(`name`, 1, LOCATE(' ', `name`) - 1), | |
`name` | |
), | |
`last_name` = IF( | |
LOCATE(' ', `name`) > 0, | |
SUBSTRING_INDEX(`name`, ' ' - 1), /* Changed line */ | |
NULL | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment