title: How to query work items with too many changesets
body: <p>These work items (and the linked changesets) are often error prone.
  So, good candidates for team code review, and should pay more attention.</p>
  
  <p>I have checked <a href="http://msdn.microsoft.com/en-us/library/bb130306.aspx" rel="nofollow">Work Item Query Language and Client Object Model</a> and <a href="http://blogs.msdn.com/b/team_foundation/archive/2010/07/02/wiql-syntax-for-link-query.aspx" rel="nofollow">WIQL syntax for Link Query</a>, but still cannot get these work items (with count of changesets) effectively.</p>
  
  <p>Is there any way to query like this (should be WIQL, SQL syntax here only for demonstration)?</p>
  
  <pre><code>SELECT [Source].[System.Id], COUNT(1) AS Changesets FROM WorkItemLinks
  WHERE [Source].[System.WorkItemType] = 'Bug'
      AND [System.Links.LinkType] = 'Changeset'
  GROUP BY [Source].[System.Id]
  HAVING Changesets &gt; 5
  </code></pre>
  
  <p>Or is there an efficient way to use the APIs, that don't need to read each work item to get the count?</p>
  
  <p>Or could only be achieved by execute SQL queries on database directly (<a href="http://social.msdn.microsoft.com/Forums/en/tfsreporting/thread/f642f51b-e030-40c9-8c9b-8ecabe0c9787" rel="nofollow">like this</a>)?</p>
  
  <p>Or can we have something like CurrentRelatedLinkCount/<a href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.workitemtracking.client.workitem.externallinkcount.aspx" rel="nofollow">ExternalLinkCount</a>/<a href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.workitemtracking.client.workitem.hyperlinkcount.aspx" rel="nofollow">HyperLinkCount</a>/<a href="http://msdn.microsoft.com/en-us/library/microsoft.teamfoundation.workitemtracking.client.workitem.relatedlinkcount.aspx" rel="nofollow">RelatedLinkCount</a>, which are supported by default (from VS IDE or API), as the query field?</p>