Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Subquery Like and Wildcards
July 22, 2010, 7:37 pm
rate this thread
Is a query like this possible? I'm trying to filter out for words
that exist in a filter table. I'd like to filter for foul language,
but for example:
"Cat" is in the filter table.
It should also filter:
WHERE comment NOT LIKE '%(Select filtered from tfilteredWords)%'
ORDER BY id DESC
LIMIT 0 , 30
Re: Subquery Like and Wildcards
It might work better if you put "%cat%" in the table. Another possibility
is to concatenate the %'s in the subquery, such as:
SELECT CONCAT('%', badword, '%') FROM ...
You really ought to consider whether this is a good idea, especially
without an exception table. For example, filtering "ass" gets 1381
other words in the dictionary file on my computer, including words
such as "grass", "glass", and "assemble".
You also get non-dictionary words such as "Massachusetts", "Mass.",
"Douglass", and "Kass", which don't appear as a dictionary word but
some of them might appear in customer names or addresses.