title: Select columns from several tables with count
body: <p>I have 3 tables in SQL Server:</p>
  <ul>
  <li>Sales (customerId)</li>
  <li>Customer (customerId, personId)</li>
  <li>Person (personId, firstName, lastName)</li>
  </ul>
  <p>and I need to return the top 10 customers.</p>
  <p>I used this query:</p>
  <pre class="lang-sql prettyprint-override"><code>SELECT TOP 10 
      CustomerID, COUNT(CustomerID)
  FROM
      Sales
  GROUP BY
      (CustomerID)
  ORDER BY 
      COUNT(CustomerID) DESC
  </code></pre>
  <p>The query currently returns only the <code>customerId</code> and count, but I also need to return the <code>firstName</code> and <code>lastName</code> of these customers from the <code>Person</code> table.</p>
  <p>I know I need to reach the <code>firstName</code> and <code>lastName</code> by correlating between <code>Sales.customerId</code> and <code>Customer.customerId</code>, and from <code>Customer.personId</code> to get the <code>Person.personId</code>.</p>
  <p>My question is whether I need to use an inner join or union, and how to use either of them to get the <code>firstName</code> and <code>lastName</code> of these customers</p>