I want the number of things in a close status
select count ( distinct thing_id ) from timed_status_of_things where status_of_thing_code = "Close"
Yes
select count ( distinct thing_id ) from timed_status_of_things where status_of_thing_code = "Close" and date_and_date < '2017-06-19 02:59:21'
What type of thing are all five of those?
select distinct t2.type_of_thing_code from timed_status_of_things as t1 join things as t2 on t1.thing_id = t2.thing_id where t1.status_of_thing_code = 'Close' and t1.date_and_date < '2017-06-19 02:59:21'
What is the distinct ID of elctronics or Commen?
select distinct thing_id from things where type_of_thing_code = "Electronics" or type_of_thing_code = "Commen"