Skip to content

Instantly share code, notes, and snippets.

@locvfx
Created August 24, 2018 08:47
Show Gist options
  • Save locvfx/181099f18396a40edbe9c017130316bb to your computer and use it in GitHub Desktop.
Save locvfx/181099f18396a40edbe9c017130316bb to your computer and use it in GitHub Desktop.
convert post's title to post's slug #MYSQL
UPDATE TABLE_NAME SET post_slug = LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(post_title), ':', ''), '’', ''), ')', ''), '(', ''), ',', ''), '\\', ''), '\/', ''), '\"', ''), '?', ''), '\'', ''), '&', ''), '!', ''), '.', ''), ' ', '-'), '--', '-'), '--', '-'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment