title: Select with when and sum
body: <p>i have table Match and i need sum of goals. If <code>Match.Home_team='Tupesy'</code> I need sum of <code>Match.Home_team='Tupesy'</code>, else <code>sum</code> of <code>Match.Away_goals</code>.</p>
  
  <p>Now i have this, but is totally wrong :/</p>
  
  <pre><code>SELECT *,
      CASE (Match.Home_team)
          WHEN (Match.Home_team='Tupesy')THEN (SUM(Match.Home_goals))
          ELSE (SUM(Match.Away_goals))
          END
  FROM Match
  Where (Match.ID_match='1');
  </code></pre>