Export (0) Print
Expand All

Exists (DMX)

Returns true if the specified sub-query returns at least one row.


EXISTS(<subquery>)

subquery

A SELECT statement of the form SELECT * FROM <column name> [WHERE <predicate list>].

Returns true if the result set returned by the subquery contains at least one row; otherwise, returns false.

You can use the NOT keyword before EXISTS: for example, WHERE NOT EXISTS (<subquery>).

The list of columns that you add to the sub-query argument of EXISTS is irrelevant; the function only checks for the existence of a row that meets the condition.

You can use EXISTS and NOT EXISTS to check for conditions in a nested table. This is useful when creating a filter that controls the data used to train or test a data mining model. For more information, see Creating Filters for Mining Models (Analysis Services - Data Mining).

The following example is based on the [Association] mining structure and mining model that you created in the Basic Data Mining Tutorial. The query returns only those cases where the customer purchased at least one patch kit.

SELECT * FROM [Association].CASES
WHERE EXISTS
(
SELECT * FROM [v Assoc Seq Line Numbers]
WHERE [[Model] = 'Patch kit'
)

Another way to view the same data that is returned by this query is to open the model in the Association viewer, right-click the itemset Patch kit = Existing, select the Drill Through option, and then select Model Cases Only.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft