title: Group by a subquery
body: <p>What is the best way of making the following <strong><code>T-SQL</code></strong> query valid:</p>
  
  <pre><code>select
      count(*),
      (... a subquery that returns one result ...) as [Bar]
  from Foo foo
  group by [Bar]
  </code></pre>