I am sort of new to sql and I have a question that I havent been able to resolve, I have a view that combines info from different tables doing different operations and basically, simplified, it looks a bit like this:
Risk_Status Task_Name Completion
---------------------------------------
Green Task1 On Time
Yellow Task2 Delayed
Yellow Task3 On Time
Green Task4 Delayed
Red Task5 Delayed
Yellow Task5 Delayed
Red Task5 On Time
Red Task5 Delayed
What I want to accomplish is to group all tasks by status, following the count of tasks that fall on each status AND have a column that list all delayed or on time tasks that fall in the different statuses as well:
Status Number of Tasks Number of Delayed Tasks
-------------------------------------------------------
Green 2 1
Yellow 3 2
Red 3 2
I have tried duplicating the view in the from clause and making it select only delayed tasks on the where class but it's not giving me accurate results, I'm not sure what else to try.
Any help is appreciated :)
Aucun commentaire:
Enregistrer un commentaire