Your Knowledge Base is moving on 3/25/24! Our new Help Center provides all the articles you know and love (plus so much more) in a one-stop shop. Ask your SPoC for details!

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))