Skip to content
Advertisement

How to exclude more rows by one match

Well, sorry but I don’t know how to formulate the subject correctly. That’s why I’d better describe the issue.

I have a kind of following table:

What I need is to find all names that matches e.g. 7. These are 'C', 'D' and 'G'.

And now I need to select all rows except 'C', 'D' and 'G'.
Resulting table is supposed to be:

I’ve tried the query:

but only realized that I still do not understand the mechanics of JOIN statements.

Hope for some help with this issue.
Thanks in advance.

Advertisement

Answer

This query:

returns all the Names that you want to exclude.
Use it with the operator NOT IN:

See the demo.
Results:

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement