<p>2 tables: </p>

<pre><code>Employees
- EmployeeID
- LeadCount


Leads
- leadID
- employeeID
</code></pre>

<p>I want to update the <code>Employees.LeadCount</code> column by counting the # of leads in the <code>Leads</code> table that have the same <code>EmployeeID</code>.</p>

<p>Note:  There may be more than 1 lead with the same employeeID, so I have to do a <code>DISTINCT(SUM(employeeID))</code>.</p>

```
```
UPDATE Employees SET LeadCount = (
  SELECT Distinct(SUM(employeeID)) FROM Leads WHERE Leads.employeeId = Employees.employeeId
)
```
```