Previous Next

FOR WHICH clauses in the USoft Rule Language serve to identify records to be deleted from a table. FOR WHICH is the equivalent of the SQL WHERE keyword in a DELETE statement.

Do not confuse with FOR.

The table being deleted from is identified in the REMOVE ALL clause, which is the equivalent of SQL DELETE.

FOR WHICH is only used in constraint SQL that (potentially) DELETEs data.


USoft Rule Language

SQL Equivalent

REMOVE ALL      drivers
FOR WHICH       age < 23

DELETE FROM    driver
WHERE          age < 23

With a subquery:

USoft Rule Language

SQL Equivalent

REMOVE ALL      drivers d
FOR WHICH exists
   SELECT      ''
   FROM        contract c
   ,           business_party b
   RELATE      b "PAYS FOR" c
   WHERE =
   AND         c.paid = 'N'

DELETE FROM      driver d
   SELECT        ''
   FROM          contract c
   ,             business_party b
   RELATE        b "PAYS FOR" c
   WHERE =
   AND           c.paid = 'N'