Skip to content
Advertisement

SQL Logic Check

I’m new to SQL/Teradata. The numbers I got from the 2nd query are not what I expected, which leads me to believe I am doing something wrong.

I have two conditions I want to count by:

Condition 1:

Condition 2 (All other Permutations):

Query for Condition 1:

I think this one is wrong . . .

Query for Condition 2

In the query for set 2 I want to return a count for “all other permutations” as noted above.

‘x’ refers to a unique Id number within the table.

Any help is much appreciated.

Advertisement

Answer

You want to negate the 1st condition, so do:

or:

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