Using QMF

Selecting rows using the IN predicate

You can use one IN statement to replace multiple OR statements.

Both of the following queries select the same rows to view on the report:

SELECT ID, NAME, YEARS, SALARY
  FROM Q.STAFF
  WHERE DEPT = 38 OR DEPT = 20 OR DEPT = 42

SELECT ID, NAME, YEARS, SALARY
  FROM Q.STAFF
  WHERE DEPT IN (38, 20, 42)

And

Use NOT with the IN statement to specify rows you do not want to select, as in the following example:

WHERE DEPT NOT IN (15, 20, 38)


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]