S
S
Sergey Popov2020-08-10 21:46:57
SQL
Sergey Popov, 2020-08-10 21:46:57

How to display all users who do not have a task in the "active" status?

Two tables. user and task. The task has two key fields, for this task - the status (new, in progress, rejected, completed) and the id of the performer.
It is necessary to display all users who currently do not have tasks in the statuses new and in progress.
I would be glad for a hint.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
kylemaclohlan, 2020-08-16
@be_a_dancer

select * 
from users 
where not exists (
select 1 
from tasks 
where executor_id = users.id 
and status in ('wip','new'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question