Search for properties that have the minimum or maximum value amongst all InfoObjects by using ALL. Keep in mind that if you use ALL, you are comparing the properties of one object with all other objects, including itself; if you do not use ALL, you are comparing the properties of a single object.
You can use the following format, where the operator can be =, !=, >, <, >=, <=, and property1 is the same type of property as property2:
<property1> operator (ALL) <property2>
SELECT
SI_ID, SI_NAME FROM CI_INFOOBJECTS WHERE SI_CHILDREN >= ALL SI_CHILDREN
(finds objects with the maximum number of children)
SELECT
SI_ID, SI_NAME FROM CI_INFOOBJECTS WHERE SI_CHILDREN <= ALL SI_CHILDREN
Note: The above examples may return more than one value, as many objects may have the same maximum or minimum number of children. In some cases, however, you can use ALL to specify uniqueness. For example, a query that searches for SI_ID >= ALL SI_ID will return a single, unique valueas long as ID is unique.
Values of two different properties can also be compared.
SELECT
SI_ID, SI_NAME FROM CI_INFOOBJECTS WHERE SI_ID != ALL SI_PARENTID
(finds objects that are not themselves parents of other objects)
SELECT
SI_ID, SI_NAME FROM CI_INFOOBJECTS WHERE SI_ID >= SI_PARENTID
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |