Count for many-to-many relationship I have the following tables:

surveys            properties   owners_properties        owners
---+------------   ----------   ------------+---------   ------
id | property_id   id           property_id | owner_id   id


I want to find the count of surveys that have more than one property owners.

Here is a rough stab:

SELECT COUNT(*) FROM surveys 
JOIN properties ON surveys.property_id = properties.id 
JOIN owners_properties...
HAVING count(properties.id &gt; 1);
You are close.  In SQL Server, you have to GROUP BY before you state HAVING.  Personally, I would do something like this

    SELECT COUNT(id) Surveys_w_2_LandOwners
    FROM surveys s
        JOIN 
        (
            SELECT COUNT(1),property_id
            FROM owners_properties
            GROUP BY property_id
            HAVING COUNT(1) &gt; 1
        ) p ON p.property_id=s.property_id