if I have a table, Tasks with the following sample rows
ID ParentID Status
1 101 Pending
2 101 Complete
3 101 Complete
4 102 Complete
Given ID =2, how can I get number of tasks not complete that belong to same parent? e.g.
Select Count(ID) from Tasks where Status <> ‘Complete’ and ID =2
above query does return correct results
Note, I do not want to do Select Count(ID) from Tasks where Status <> ‘Complete’ and ParentID=101 i.e. I do not want to pass parentID in query, just ID of one of the records that belong to same parent.
thanks.
Aucun commentaire:
Enregistrer un commentaire