Your Knowledge Base has moved to the new Help Center.  Check out the release notes for details. And don't forget to update your bookmarks and in-house documentation before May 28.

EXISTS

 
EXISTS checks if a query has any rows and returns True or False.

Syntax

EXISTS ( subquery )

Use

EXISTS is often used in the filter of Views or Dependent Clause of Processes to determine if the record in question has related records with specific values.

Examples

In the following example, a View on Contacts with this filter will only return Contacts that are registered in an active Event:

EXISTS(SELECT 1 FROM Event_Participants EP 
  JOIN Events E ON E.Event_ID = EP.Event_ID 
  WHERE EP.Participant_ID = Contacts.Participant_Record 
    AND GETDATE() BETWEEN E.Event_Start_Date AND ISNULL(E.Event_End_Date,GETDATE()+1))