Question: What are the distinct id and type of the thing that has the status 'Close' or has a status record before the date '2017-06-19 02:59:21'
Schema: create table timed_status_of_things (thing_id varchar, status_of_thing_code varchar, date_and_date varchar, PRIMARY KEY (thing_id)); create table things (thing_id varchar, type_of_thing_code varchar, PRIMARY KEY (thing_id))
SQL: select distinct t2.thing_id, 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' or t1.date_and_date < '2017-06-19 02:59:21'