SELECT DISTINCT
	d.DocumentID,
    d.Filename AS [FileName],
    --p.Path AS [FolderPath],
    p.Path + d.Filename AS [FullVaultPath]
	--v.ValueText,
    --d.DocumentID
    --d.CurrentVersion
FROM [Drilling_Test].[dbo].[Documents] d
INNER JOIN [Drilling_Test].[dbo].[DocumentsInProjects] dp on d.[DocumentID] = dp.DocumentID 
INNER JOIN [Drilling_Test].[dbo].[Projects] p on dp.ProjectID = p.ProjectID
INNER JOIN [Drilling_Test].[dbo].[VariableValue] v on d.DocumentID = v.DocumentID
WHERE v.VariableID = 57 and p.Path like '%DWS%'
ORDER BY [FullVaultPath] asc;
