title: sql query to select matching rows for all or nothing criteria
body: <p>I have a table of cars where each car belongs to a company. In another table I have a list of company locations by city.</p>
  
  <p>I want to select all cars from the cars table whose company has locations on all cities passed into the stored procedure, otherwise exclude those cars all together even if it falls short of one city.</p>
  
  <p>So, I've tried something like:</p>
  
  <pre><code>select id, cartype from cars where companyid in 
  (
    select id from locations where cityid in 
    (
       select id from cities
    )
  )
  </code></pre>
  
  <p>This doesn't work as it obviously satisfies the condition if ANY of the cities are in the list, not all of them.</p>
  
  <p>It sounds like a group by count, but can't make it work with what I tried.</p>
  
  <p>I"m using MS SQL 2005</p>