So, say for a database update, which for some reason you cannot script using your normal scripting language, you need to extract a part of a URL (a slug for example) from a complete URL

SELECT TRIM(BOTH '/' FROM SUBSTRING(TRIM(LEADING '/' FROM link_url), 
locate('/', TRIM(LEADING '/' FROM link_url)))) FROM page_links
  • By: Andrew Kirkpatrick
  • In: Uncategorised
  • Under: