title: SQL Select with Distinct
body: <p>With this data</p>
  
  <pre><code>Team Name Won
  X    Andy  1
  X    Cara  1
  X    Cara  1
  X    Eric  0
  X    Eric  0
  X    Eric  0
  X    Eric  0
  Y    Bill  0
  Y    Dave  0
  Y    Dave  1
  Y    Dave  1
  </code></pre>
  
  <p>I want for each team the number of players and the number of winners</p>
  
  <pre><code>Team Players Winners
  X       3       2
  Y       2       1
  </code></pre>
  
  <p>Does it in two queries:</p>
  
  <pre><code>select team, count(distinct Name) as Players from test group by team
  select team, count(distinct Name) as Winners from test where Won=1 group by team
  </code></pre>
  
  <p>but I can't work out the syntax to do it in one. TIA for your help. John</p>