如何将第一个查询的结果与第二个查询结合起来,EMPLID
表和Z_EMP_YAN
表的Z_OPRDEFN
列匹配?
select b.OPRID
from Z_EMP_BENFT a, PSOPRDEFN b
WHERE a.EMPLID = b.EMPLID
AND A.Z_PEND_COVER = 'Y'
AND OPRID LIKE 'ZZ%'
select EMPLID from z_emp_yan where z_yan_action_id = 1
答案 0 :(得分:3)
上一篇文章没有什么问题,我更喜欢使用Joins
:
select b.oprid
from ps_z_emp_benft a
join psoprdefn b on a.emplid = b.emplid
join ps_z_emp_yan c on a.emplid = c.emplid
where A.z_pend_cover = 'Y'
and oprid LIKE 'ZZ%'
and c.z_yan_action_id = 1
答案 1 :(得分:2)
试试这个
SELECT b.oprid
FROM ps_z_emp_benft a,
psoprdefn b,
ps_z_emp_yan c
WHERE a.emplid = b.emplid
AND a.emplid = c.emplid
AND A.z_pend_cover = 'Y'
AND oprid LIKE 'ZZ%'
AND c.z_yan_action_id = 1