title: sql How to get sum of a distinct values according to set of distincted condition query
body: <p>I want to get two columns with group1 having distinct values where c3= yes and group2 where it has sum(c2) according to group1 .</p>
  
  <pre><code>c1   |   c2   | c3
  --------------|-----
  A    |   2    |yes
  B    |   1    |yes
  A    |   2    |yes
  B    |   1    |yes
  C    |   2    |no
  C    |   1    |no
  
  
  
  
  result :
  
  
  group1 | group2
  ---------------
  A      | 4
  B      | 2
  </code></pre>
  
  <p>I am trying this query but not working</p>
  
  <pre><code>SELECT SUM(c2) WHERE DISTINCT c1 in('A','B') and c3='yes' as 'group2' from table,
      SELECT DISTINCT c1 in('A','B') as 'group1' from table
  </code></pre>