Hello friends,
I am here to share a issue which I faced once, That is I want to separate a columns values into 2 columns.
So if you are also looking to separate a columns value into 2 columns, You can use following syntax-
UPDATE your_table SET column1 = SUBSTRING_INDEX(your_table.column1,'(', 1), column2 = SUBSTRING_INDEX(your_able.column1,'(', -1);
For example, you have a table 'user' and a column 'firstname' with the value 'firstname lastname'. Here ' ' (space) is used as separator. Now you have to separate the firstname and lastname into 2 separate columns. You can use following query-
UPDATE user SET firstname = SUBSTRING_INDEX(user.firstname,'(', 1), lastname = SUBSTRING_INDEX(user.firstname,'(', -1);
0 Comment(s)