I am trying to create a report showing estimated time vs actual time using Team Foundation Server 2017 for User Stories and Bugs. If I execute the following query I get all of the tasks and bugs:
SELECT * FROM [Tfs_Warehouse].[dbo].[DimWorkItem]
I understand that a User Story can have zero to many tasks and the same goes for a Bug. How do I find the parent User Stories and child tasks as well as the Bugs and their child tasks?
The end goal is a report something like the image below: