The reason they don't add up is that in query 1, you have a condition Query 1: (this) AND NOT (that). Queries 2 and three have only one condition Query 2: (this) Query 3: (that) You undoubtedly have some records where (this) is true AND (that) is true and also where they are both false. Try modifying query 1 (take out NOT) (railway NOT IN (Null,'') AND osmSupportingElement = 'no') AND (railway IN ('platform') AND (osm_level LIKE ('%-%') OR osm_layer LIKE ('%-%') OR osm_location IN ('underground','underwater'))) and see what you get. Also try breaking the queries into smaller pieces and you may come by the answer on your own (see my comment).