Wanted to ask if anyone can help me with (code or commands to use) an sql query to count how many times the question mark character appears in table *exp_comments*, field comment?
Thanks! Lee
To get a total of all occurrences across all comments:
SELECT SUM(LENGTH(comment) - LENGTH(REPLACE(comment, '?', ''))) AS occurrences FROM exp_comments
To get the count for each comment in a query result:
SELECT LENGTH(comment) - LENGTH(REPLACE(comment, '?', '')) AS occurrences FROM exp_comments
(MySQL doesn't have a specific function for this, but I found this clever technique - which takes the field's character count and subtracts its count with all of your target character removed - here.)