You can do something like this:
-- If value is found in table2, select from table1
select * -- <- use padding if necessary
from table1
where exists (select 1
from table2
where myField = value)
union all
-- If value is not found in table2, select from another_Table
select * -- <- use padding if necessary
from another_Table
where not exists (select 1
from table2
where myField = value)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…