mysql - How to identify entries with all completed tasks? -
let's have table task_status below:
id taskid subtaskid status 1 1 1 complete 2 1 2 complete 3 1 3 complete 4 2 4 inprogress 5 2 5 complete i want find taskid child tasks complete. how can write query?
use group by , having check if number of rows per task equal number of rows complete status.
select taskid tbl group taskid having count(*) = sum(status='complete')
Comments
Post a Comment