Skip to content

Instantly share code, notes, and snippets.

@fiftin
Last active November 22, 2016 07:25
Show Gist options
  • Save fiftin/f28d74431f10d6ae6a3f0da7d608ed05 to your computer and use it in GitHub Desktop.
Save fiftin/f28d74431f10d6ae6a3f0da7d608ed05 to your computer and use it in GitHub Desktop.
Count the number of occurrences of a char in MySQL
UPDATE Entities SET depth = (LENGTH(path) - LENGTH(REPLACE(path, '/', ''))) + 2 WHERE path <> '';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment