Split value from one field to two

前端 未结 14 2385
面向向阳花
面向向阳花 2020-11-22 03:49

I\'ve got a table field membername which contains both the last name and the first name of users. Is it possible to split those into 2 fields memberfirst<

14条回答
  •  执念已碎
    2020-11-22 04:10

    UPDATE `salary_generation_tbl` SET
        `modified_by` = IF(
            LOCATE('$', `other_salary_string`) > 0,
            SUBSTRING(`other_salary_string`, 1, LOCATE('$', `other_salary_string`) - 1),
            `other_salary_string`
        ),
        `other_salary` = IF(
            LOCATE('$', `other_salary_string`) > 0,
            SUBSTRING(`other_salary_string`, LOCATE('$', `other_salary_string`) + 1),
            NULL
        );
    

提交回复
热议问题