I know, this could easly be done using PHP, but just curious,
How could I explode on mail
field to select the value from alias
column with the first exploded part by @
?
Current:
+-------+-----------------------------------------+
| alias | mail |
+-------+-----------------------------------------+
| | user.one@gmail.com |
| | user.two.foo@gmail.com |
+-------+-----------------------------------------+
Desired:
+-------+------------------------------------------------+
| alias | mail |
+-------+------------------------------------------------+
| user.one | user.one@gmail.com |
| user.two.foo | user.two.foo@gmail.com |
+-------+------------------------------------------------+
In pseudo code would be like
update tablename set tablename.alias = explode('@', tablename.mail)[0];