How many distinct locations have the things with service detail 'Unsatisfied' been located in?
create table timed_locations_of_things (location_code varchar, thing_id varchar, PRIMARY KEY (location_code)); create table things (thing_id varchar, service_details varchar, PRIMARY KEY (thing_id))
select count(distinct t2.location_code) from things as t1 join timed_locations_of_things as t2 on t1.thing_id = t2.thing_id where t1.service_details = 'unsatisfied'