This query should only show results for items linked to "X" but not "Y". However this does not seem to treat the AND correctly.
SELECT
[System.Id],
[System.Title],
[Microsoft.VSTS.Common.Severity],
[System.AreaPath],
[Custom.BugState],
[System.State],
[Custom.MilestoneIDList],
[System.CreatedDate],
[System.WorkItemType]
FROM workitemLinks
WHERE
(
[Source].[System.WorkItemType] = 'Bug'
AND NOT [Source].[System.Title] CONTAINS 'Squish'
AND [Source].[Custom.BugState] <> 'Closed'
AND NOT [Source].[System.Title] CONTAINS 'Integration'
)
AND (
[System.Links.LinkType] = 'System.LinkTypes.Related-Forward'
)
AND (
[Target].[System.WorkItemType] = 'Milestone'
AND [Target].[System.Title] CONTAINS 'X'
AND NOT [Target].[System.Title] CONTAINS 'Y'
)
ORDER BY [System.AreaPath],
[System.Id]
MODE (MustContain)
This query should only show results for items linked to "X" but not "Y". However this does not seem to treat the AND correctly.
SELECT [System.Id], [System.Title], [Microsoft.VSTS.Common.Severity], [System.AreaPath], [Custom.BugState], [System.State], [Custom.MilestoneIDList], [System.CreatedDate], [System.WorkItemType] FROM workitemLinks WHERE ( [Source].[System.WorkItemType] = 'Bug' AND NOT [Source].[System.Title] CONTAINS 'Squish' AND [Source].[Custom.BugState] <> 'Closed' AND NOT [Source].[System.Title] CONTAINS 'Integration' ) AND ( [System.Links.LinkType] = 'System.LinkTypes.Related-Forward' ) AND ( [Target].[System.WorkItemType] = 'Milestone' AND [Target].[System.Title] CONTAINS 'X' AND NOT [Target].[System.Title] CONTAINS 'Y' ) ORDER BY [System.AreaPath], [System.Id] MODE (MustContain)