I have a table in mySQL and want to update a specific column in one directory. The directory structure should be extended and related columns should be updated with the sub-directory. So I do not have many rows to update to see a convenient script for doing.
Example :.
The directory containing the column c1
/ startpoint / dir_a / / startpoint / dir_a / subdir_1 / / startpoint / dir_a / subdir_1 / subsubdir_1 / / startpoint / dir_a / subdir_1 / subsubdir_2 / / Startpoint / dir_a / subdir_1 / subsubdir_3 / / startpoint / dir_a / subdir_2 / / startpoint / dir_a / subdir_3 / So I start the starting point / directory after the directories is required.
It should be after the script:
/ startpoint / system / dir_a / / startpoint / system / dir_a / subdir_1 / / startpoint / system / dir_a / subdir_1 / subsubdir_1 / / Startpoint / system / dir_a / subdir_1 / subsubdir_2 / / startpoint / system / dir_a / subdir_1 / subsubdir_3 / / startpoint / system / dir_a / subdir_2 / / startpoint / system / dir_a / subdir_3 / My (probably stupid) update did not work as expected: update table1 set dir = / startpoint / system / || Substr (dir, 12) Where '/ startpoint / dir_a /%' like dir Then to get any idea from the specialist with this one more specific SQL update?
Thank you.
You
update table set dir = REPLACE (dir, / 'Startpoint / dir_a /', '/ startpoint / system / dir_a /' Where are the directories like '/ startpoint / dir_a /%' But be careful because it's' / startpoint / DIAR_A / 'If your path is something' / startpoint / DIAR_A / Random_deer / initial point / DIAR_A / 'then it must be messed up
No comments:
Post a Comment