I am trying to get all current project names and request names from TFS that are not closed and have hotfix as '1'. This is the query I used
Select Distinct wi.System_Title,TP.ProjectNodeName
FROM Tfs_Warehouse.dbo.FactCurrentWorkItem FCWI
INNER join Tfs_Warehouse.dbo.DimTeamProject TP
ON FCWI.LastUpdatedDateTime = TP.LastUpdatedDateTime
INNER JOIN Tfs_Warehouse.dbo.DimWorkItem wi
ON TP.ProjectNodeSK = wi.TeamProjectSK
WHERE
wi.CDS_Project_HotFixRelated LIKE '1' AND
System_state NOT LIKE 'Closed'
AND wi.System_IsDeleted = '0'
AND wi.System_WorkItemType LIKE 'Request'
Order by System_Title DESC
If I use Tfs_Warehouse.dbo.DimWorkItem instead of FactCurrentWorkItem I can get results but the problem with Tfs_Warehouse.dbo.DimWorkItem is that it shows all the history too, including states of the project that does not exist anymore