Decode Analytics

View Original

Where IN

WHERE IN returns values that matches values in a list or the results of a subquery.

SQL Where IN Syntax:

SELECT Column1, Column2, Column3

FROM Table_Name

WHERE Column1 IN ( Value1, Value2, Value3)


Example:

Lets use the “Orders” table to find all Orders with the ProductID of two, four, and five.

See this content in the original post

Results:

See this content in the original post

Lets find all orders with an OrderID greater than 13 using a subquery for the filter.

See this content in the original post

Results:



See this content in the original post

SQL Tutorial

See this content in the original post