SELECT thing2.thing3id FROM o, thing1, thing2 WHERE O.id= ? AND o.thing1_id = thing1.id AND thing1.thing2id = thing2.id