title: SQL query using COUNT with the Select statement
body: <p>Let's say, for example, that we’re looking for the number of orders each salesperson has taken for our first 10 customers. We can use both the <code>SalesPersonID</code> and <code>CustomerID</code> columns in our <code>GROUP BY</code></p>
  
  <p>I'm not 100% sure on how the <code>COUNT(*)</code> is returning the values on the 3rd column. I'm using AdventureWorks2008. What and how is the query returning the value of 3 - which is supposed to be the number of orders taken.</p>
  
  <pre><code>SELECT 
      CustomerID, SalesPersonID, COUNT(*)
  FROM 
      Sales.SalesOrderHeader
  WHERE 
      CustomerID &lt;= 11010
  GROUP BY 
      CustomerID, SalesPersonID
  ORDER BY 
      CustomerID, SalesPersonID;
  </code></pre>
  
  <p>Result ==></p>
  
  <pre><code>CustomerID SalesPersonID
  ----------- ------------- -----------
  11000          NULL            3
  11001          NULL            3
  11002          NULL            3
  11003          NULL            3
  11004          NULL            3
  11005          NULL            3 
  </code></pre>