Gad
Gad

Reputation: 42316

another mysql minus question

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?

Upvotes: 2

Views: 1122

Answers (1)

Olaf Kock
Olaf Kock

Reputation: 48077

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.

Upvotes: 2

Related Questions