请问如何检查此SQL问题的类似结果组。
===========
EMPLOYEE
===========
ID | Name |
===========
1 | EMP1 |
2 | EMP2 |
==================
HASSKILL
==================
EMPID | SkillID |
1 | 001 |
1 | 002 |
1 | 003 |
2 | 003 |
2 | 004 |
2 | 005 |
JOB
===================
JobID | NEEDSKILL |
===================
1 | 002 |
1 | 003 |
我可以使用以下命令获得作业所需的技能:
SELECT NEEDSKILL FROM JOB WHERE JobID = 1;
如何在没有pl / sql的情况下“循环”通过员工并显示具有作业1所需技能的员工?
答案 0 :(得分:2)
select empid from HASSKILL, JOB
where jobid = 1 and skillid = needskill
group by empid
having count(0) = (select count(0) from JOB where jobid = 1)