Table1
________
ID Name
_______________
1 First
2 Second
我需要一个查询,该查询将返回Table2中Field1 ='Test'的记录不存在的First
并在表1中存在ID = 1且其中Field1 ='Test'
Second
答案 0 :(得分:0)
这浮现在脑海:
select (case when exists (select 1 from table2 t2 where t2.field1 = 'Test')
then 'Second' else 'First'
end)
from dual;
但是,它不使用table1
。