Skip to content
Advertisement

Select rowst where ID is on list and meet 2 other requirement, probably subquery in Teradata SQL?

I have table in Teradata SQL like below:

And I have list of ID of clients:

And I need to select ID of clients from table which are on myList and meet requirements:

  1. In col1 value is “A” or “B”
  2. In col2 value is bigger than 10 (>10)

So as a result I need like below:

Because ID = 111 and is on myList, col1 is “A” or “B” and in col2 is value bigger than 10.

How can I do that in Teradata SQL ? Probably in subquery ?

Advertisement

Answer

There is no need for a subquery.
All conditions can be combined with the AND operator in the WHERE clause of a simple SELECT statement:

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