tags:

views:

331

answers:

1

Hi community,

I'm trying to achieve the following:

SELECT id, name FROM t_profiles MINUS (SELECT p.id, p.name FROM t_profiles AS p LEFT JOIN t_skills AS s ON p.id = s.id_employee WHERE s.lvl>0 and s.id_task=1)

Is there an easy way to do this in MySQL?

+3  A: 
SELECT id, name FROM t_profiles 
WHERE id not in 
   (SELECT p.id FROM t_profiles AS p 
    LEFT JOIN t_skills AS s ON p.id = s.id_employee 
    WHERE s.lvl>0 and s.id_task=1)

should do the trick.

Olaf