Skip to content
Advertisement

Select with condition and check

This is my table:

I want create query where I can select only tasks_name where task_status “complete” for both task_id. For example one task which name foo have two task_id such as 12 and 13 and both of them have task_status complete. In contrast task with name bar have only one task_id “completed”, so its fall for my condition. I expect get table like this:

How I can select, check and return where task_name is same for each task_id and both of them have task_status completed

Advertisement

Answer

It is much easier to do this using min, max and a subquery.

Data output:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement