I'm trying to remove "bad words" from a table using a list of offensive words from another table, but the offensive words are often in lemma form. Thus, I can't always do a exact match. I need to use a LIKE quantifier, for example WHERE text LIKE '%badword%'
Is there a way for me to try to select all the rows that contains a word from another table, but by specifically using the LIKE clause.
I'll give an example of what I was trying to do. This didn't work, but should give you an idea of what I'm trying to do:
SELECT *
FROM entry
WHERE headword LIKE IN
( SELECT word
FROM sies )
Now I know that the LIKE doesn't fit into this query, but I'm trying to get something to this effect working.
EDIT: This is the latest thing I tried, that did not work:
SELECT s.*
FROM sies AS s, entry AS e
WHERE e.headword LIKE ('%' + s.word + '%')
You can try the following query:
select s.* from sies s, entry e where s.words like '%' || e.word || '%'
Here I have assumed that, sies
is your regular table and entry
is the table with the dirty words.
You can check the Demo here.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments