Created
September 25, 2016 08:28
-
-
Save ognjenm/7d59b6c82ee1d0e3376e717b957a6363 to your computer and use it in GitHub Desktop.
MySQL create slug from title
This file contains hidden or 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 some_table SET slug = LOWER(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(TRIM(title_field),'ž',''),'đ',''),'š',''),'ć',''),'č',''), ':', ''), ')', ''), '(', ''), ',', ''), '\\', ''), '\/', ''), '\"', ''), '?', ''), '\'', ''), '&', ''), '!', ''), '.', ''), ' ', '-'), '--', '-'), '--', '-')) | |
| WHERE slug = ''; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment