I have a table called COMMENTS that looks like this:
| First Name | Text |
| ------------ | ------------ |
| Frankie | Frankie is... |
| Sarah | Sarah is... |
| Graham | Graham is... |
and another table, NAMES, that lists all the names:
First name |
---|
Frankie |
Sarah |
Graham |
Richard |
Graham |
I am trying to write a SELECT statement that returns all the rows where the text in 'Text' contains a name from 'First name', which isn't their own.
The issue I have faced so far is that the 'First Name' always returns true because their own name exists in the list of all names.
I'm after a statement that returns when:
If 'Text' contains a name from NAMES that isn't their own return that row.
Is this even possible with SELECT statements?
2条答案
按热度按时间vatpfxk51#
This returns comments with all the names in their text, except the commenter's own name:
5fjcxozz2#
Not obvious, but doable: