title: MYSQL sum() for distinct rows
body: <p>I'm looking for help using sum() in my SQL query:</p>
  
  <pre><code>SELECT links.id, 
         count(DISTINCT stats.id) as clicks, 
         count(DISTINCT conversions.id) as conversions, 
         sum(conversions.value) as conversion_value 
  FROM links 
  LEFT OUTER JOIN stats ON links.id = stats.parent_id 
  LEFT OUTER JOIN conversions ON links.id = conversions.link_id 
  GROUP BY links.id 
  ORDER BY links.created desc;
  </code></pre>
  
  <p>I use <code>DISTINCT</code> because I'm doing "group by" and this ensures the same row is not counted more than once.</p>
  
  <p>The problem is that SUM(conversions.value) counts the "value" for each row more than once (due to the group by)</p>
  
  <p>I basically want to do <code>SUM(conversions.value)</code> for each DISTINCT conversions.id.</p>
  
  <p>Is that possible?</p>