Previous Topic: OQ142002Next Topic: OQ142004


OQ142003

The NOT logical operator is not valid for set names.

Reason:

The NOT logical operator cannot be used on a set name specified in a SELECT statement's WHERE criteria. To retrieve records that do not participate in a given set or that lack members in that set, use a construction like the one shown in the following example:

Two records (A and B) are connected by optional set (A-B). To return all A occurrences with no B occurrences in the set, specify:

SELECT *
  FROM A
   WHERE NOT EXISTS
      (SELECT *
        FROM B
         WHERE A-B)

To return all B occurrences that are not owned by any A occurrences in the set, issue:

SELECT *
 FROM B
   WHERE NOT EXISTS
      (SELECT *
        FROM A
         WHERE A-B)

Module:

OLQSSQLO

Severity:

0