как-то так:
см. на
sqlfiddleselect e.id, e.name
from employee e
join (
select employee_id
from empl_services es
join services s on s.id = es.service_id
where s.title in ('Крутит гайки','Носит ящики')
group by employee_id
having count(1) = 2
) t on t.employee_id = e.id
;
-- если id услуг известны то так:
select e.id, e.name
from employee e
join (
select employee_id
from empl_services es
where service_id in (1,3)
group by employee_id
having count(1) = 2
) t on t.employee_id = e.id
;
PS: тут обязательно надо в выражении having count(1) = ?? подставлять количество услуг перечисляемых в IN(...)
на 8ке можно по другому через WITH, а в having count(1) подставлять count по подзапросу услуг...
UPD:
на 8ке так:
with
s as (
select id from services where title in ('Крутит гайки','Носит ящики')
),
r as (
select employee_id from empl_services es
join s on s.id = es.service_id
group by employee_id
having count(employee_id) = (select count(1) from s)
)
select *
from employee e
join r on r.employee_id = e.id
;
см. на
dbfiddle