Returns the number of uses of any given word by each user. Post history and Suggested edits may count more than once, and will count once for each editor, since the diffing is tough.
Q&A for gamemasters and players of tabletop, paper-and-pencil role-playing games
declare @var varchar(20) declare @var2 varchar(20) set @var = 'abc _qua_ def'; set @var2 = 'abc equal def'; declare @match varchar(5) set @match = '%_qua%'; select case when @var like @match then '_qua_ matches' else '_qua_ doesn''t match' end, case when @var2 like @match then 'equal matches' else 'equal doesn''t match' end /* select userid, text, id, 'comment' from comments where text like '% qua %' or text like '% *qua* %' or text like '% \_qua\_ %' union select userid, text, id, 'posthistory text' from posthistory where text like '% qua %' or text like '% *qua* %' union select userid, comment, id, 'posthistory comment' from posthistory where comment like '% qua %' or comment like '% *qua* %' union select owneruserid, text, id, 'suggestededit text' from suggestededits where text like '% qua %' or text like '% *qua* %' union select owneruserid, title, id, 'suggestededit title' from suggestededits where title like '% qua %' or title like '% *qua* %' */