Skip to content

Instantly share code, notes, and snippets.

@krschmidt
Created January 10, 2017 16:41
Show Gist options
  • Save krschmidt/b5cec4fb708a2386e936020e863b9d44 to your computer and use it in GitHub Desktop.
Save krschmidt/b5cec4fb708a2386e936020e863b9d44 to your computer and use it in GitHub Desktop.
Counts occurances of non-breaking spaces in the body field of a Drupal site
SELECT f.entity_id,
f.bundle,
Sum(f.counts) c
FROM (SELECT entity_id,
bundle,
Format((Length(body_value) - Length(REPLACE(body_value, ' ', ''))) / Length(' '), 0) AS counts
FROM field_data_body) AS f
GROUP BY f.entity_id
ORDER BY c ASC;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment