I am trying to count the number of records in a table.
The table is called affiliations and only has 4 columns (2 of which are foreign keys)

I want to count the number of records where the affiliated column is 0 and the business\_id is related to a particular account\_email.

I know how to do this query using the IN keyword, but I was wondering if there is a better or more efficient way to do this.

This is the IN version of the query:

```
SELECT COUNT(1) FROM affiliations 
WHERE business_id IN (
    SELECT business_id 
    FROM affiliations 
    WHERE account_email = 'address@domain.ext'
) AND affiliated = 0

```

I understand I could probably replace this with EXISTS:

```
SELECT COUNT(1) FROM affiliations 
WHERE EXISTS (
    SELECT 1 FROM affiliations 
    WHERE account_email = 'address@domain.ext'
) AND affiliated = 0

```

Would the statement with EXISTS work? And as previously asked, is there just a better way to do this?

Thanks in advance!