Created
July 5, 2016 13:52
-
-
Save CrisHazzard/659f54ba4e4de30c665e24d5ce81e9dd to your computer and use it in GitHub Desktop.
SQL Script to Remove leading directory from SQL field
This file contains 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 `table_name` SET `field_value` = SUBSTRING_INDEX(field_value, /', -1) WHERE `col_value` = 'col_match' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I originally added subdirectories to my uploads directory for media to test for an SEO benefit, but there was none. I needed to remove the subdirectories from all the media for hikes all over the country that had different paths. This statement in PHYMyAdmin did the trick.