title: Multiple COUNT / GROUP BY statements return unexpected results
body: <p>Querying a postgreSQL 9.4 db, I want to be able to see how often each customer is interacting with each employee based on previous orders. My aim is to retrieve data in the following format:      </p>
  
  <pre><code>CUSTOMER     EMPLOYEE    INTERACTIONS   CUSTOMER_TOTAL
  Customer1    EmployeeA             30               50
  Customer1    EmployeeB             20               50
  Customer2    EmployeeD              6               15
  Customer2    EmployeeA              6               15
  Customer2    EmployeeC              3               15
  </code></pre>
  
  <p>...where I have a separate record in the results for every combination of customer and employee (assuming at least one order has taken place between the two).</p>
  
  <p>I want to include a column containing the number of orders between a customer and each individual employee (See column 3 above), and another column with the total number of orders for each customer overall (see column 4 above). </p>
  
  <p>I've written the following query:</p>
  
  <pre><code>SELECT customer.name as Customer, employee.name as Employee, 
    SUM(CASE WHEN orders.employee_id = employee.id AND orders.customer_id = customer.id THEN 1 ELSE 0 END) AS Interactions,
    SUM(CASE WHEN orders.customer_id = customer.id THEN 1 ELSE 0 END) AS Customer_Total
  
  FROM tblcustomer customer
    JOIN tblorder orders ON orders.customer_id = customer.id
    LEFT JOIN tblemployee employee ON employee.id = orders.employee_id
  
  GROUP BY customer.name, employee.name
  
  ORDER BY Customer, Interactions DESC; 
  </code></pre>
  
  <p>Which returned the following results:</p>
  
  <pre><code>CUSTOMER     EMPLOYEE    INTERACTIONS   CUSTOMER_TOTAL
  Customer1    EmployeeA             30               30
  Customer1    EmployeeB             20               20
  Customer2    EmployeeD              6                6
  Customer2    EmployeeA              6                6
  Customer2    EmployeeC              3                3
  </code></pre>
  
  <p>All rows / columns appear as expected, except for the final column. Instead of a count of total orders for each customer, it has returned only the orders where the employee is also a match. Where have I gone wrong?</p>