0

如何将第一个查询的结果与表和表的EMPLID列匹配的第二个查询结合起来?Z_EMP_YANZ_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
4

2 回答 2

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 
于 2013-10-07T18:13:33.343 回答
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 
于 2013-10-07T18:05:10.127 回答