I have a problem with comparing a value in my sql database with a list of object in my code.

The object does not exist in DB

Example of an object in the list:

```
{
    public long CompareId
    public bool HasAccess
}

```

I'm using SQLBuilder in c#
And then I want to make a query that says something like this:

**In made up code**

```
SELECT * FROM EntityPermission
WHERE EntityPermission.HasAccess = listOfObjects.Where(obj => obj.CompareId == EntityPermission.CompareId).HasAccess

```

**In more made up code but with sql builder**

```
query.WHERE("(EntityPermission.HasAccess = {0})", listOfObjects.Where(obj => obj.CompareId == EntityPermission.CompareId).HasAccess)

```

I'm fully aware of that I'm mixing c# and sql here, but it was the best way I could explain what I want to accomplish.

**In words**

I want to find the EntityPermission where the HasAccess column is equal to the HasAccess property of the object where they have the same Id.

Really thankful for all help!