title: MySQL Left Join throwing off my count numbers
body: <p>I'm doing a left join on a table to get the number of leads we've generated today and how many times we've called those leads. I figured a left join would be the best thing to do, so I wrote the following query:<br></p>
  
  <pre><code>SELECT 
      COUNT(rad.phone_number) as lead_number, rals.lead_source_name as source, COUNT(racl.phone_number) as calls, SUM(case when racl.contacted = 1 then 1 else 0 end) as contacted
  FROM reporting_app_data rad 
  LEFT JOIN reporting_app_call_logs racl ON rad.phone_number = racl.phone_number, reporting_app_lead_sources rals
  WHERE DATE(rad.created_at) = CURDATE() AND rals.list_id = rad.lead_source
  GROUP BY rad.lead_source;
  </code></pre>
  
  <p>But the problem with that, is that if in the <code>reporting_app_call_logs</code> table, there are multiple entries for the same phone number (so a phone number has been called multiple times that day), the lead_number (which I want to count how many leads were generated on the current day grouped by lead_source) equals how many calls there are. So the count from the LEFT table equals the count from the RIGHT table.</p>
  
  <p><strong>How do I write a SQL query that gets the number of leads and the total number of calls per lead source?</strong></p>