Skip to content
Advertisement

How to exclude certain values from a Query [SQL]

as the title states, an NotPrimID, can have two different values Example 1 and Example 2

IF: if NotPrimID does have both values, it should be automatically excluded from the query result.

What i want: Query, that will deliever all the NotPrimID, that only have “Example 1” as a result, however if NotPrimID does have “Example 2” also as a possible result, it should be automatically excluded.

Question: How to exclude certain NotPrimID, if it does have additional values ?

Advertisement

Answer

You can use group by and having:

This returns all notprimids that have only one distinct text, whose value must be 'Example1'.

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