select * from table1 where table1.category = 1 OR table1.category = (select table2.id from table2 where table2.parent_id = 1)