SQL IN || DB2 for i SQL

IN predicate in Search condition in DB2 for i SQL
IN predicate in Search condition in DB2 for i SQL, IBMi DB2, SQL, SQL Tutorial, DB2 for i SQL
IN predicate in Search condition in DB2 for i SQL

It is used to get the rows that falls in the listed values in IN expression. For Example, refer to the Customer table and find out all the customer ids whose city in CHENNAI and KOLKATE.

SELECT * FROM customer WHERE CUSTCITY IN ('CHENNAI', 'KOLKATA')

Output:

CUSTID   CUSTNAME              CUSTCITY              CUSTSTATE             CUSTCOUNTRY
     7   Mounish               KOLKATA               WEST BENGAL           INDIA      
     8   Annamalai             CHENNAI               TAMIL NADU            INDIA      
     9   Kannan                CHENNAI               TAMIL NADU            INDIA      

Post a Comment

© AS400 and SQL Tricks. All rights reserved. Developed by Jago Desain