select a.id,a.name,a.age,decode(a.type,'A',(select time from T2 where id=a.id),'B',(select time from T3 where id=a.id),'cannotFind') from T1 a; 成不?
select a.id,a.姓名,b.入司时间 from emp a, 甲类人员类别1表 b where a.类别标志 = '甲' union all select a.id,a.姓名,b.入司时间 from emp a, 乙类人员类别1表 b where a.类别标志 = '乙'
还是: select a.id,a.name,a.age, (case when exists(select 'X' from T2 where id=a.id) then (select time from T2 where id=a.id) when exists(select 'X' from T3 where id=a.id) then (select time from T3 where id=a.id) else 'cannotFind' end) from T1 a;
select id,姓名,入司时间 from emp,甲类人员类别1表 where emp.类别标志='甲类' and emp.id=甲类人员类别1表.id union all select id,姓名,入司时间 from emp,乙类人员类别1表 where emp.类别标志='乙类' and emp.id= and emp.id=乙类人员类别1表.id
from T1 a;
成不?
a.id,a.姓名,b.入司时间
from
emp a,
甲类人员类别1表 b
where
a.类别标志 = '甲'
union all
select
a.id,a.姓名,b.入司时间
from
emp a,
乙类人员类别1表 b
where
a.类别标志 = '乙'
select a.id,a.name,a.age,
(case
when exists(select 'X' from T2 where id=a.id) then (select time from T2 where id=a.id)
when exists(select 'X' from T3 where id=a.id) then (select time from T3 where id=a.id)
else 'cannotFind'
end)
from T1 a;
and emp.id=甲类人员类别1表.id
union all
select id,姓名,入司时间 from emp,乙类人员类别1表 where emp.类别标志='乙类' and emp.id=
and emp.id=乙类人员类别1表.id