title: Count the number of orders
body: <p>I have a table (Table1) with the columns <code>order_item_id</code> <code>customer_id</code> and <code>order_id</code> in which I want to count the number of orders per customer. Unfortunately an order with more than one article has the same <code>order_id</code></p>
  
  <pre><code>|order_item_id|order_id|customer_id|
  |     2       |   30   |    1      | 
  |     3       |   30   |    1      | 
  |     4       |   42   |    1      | 
  |     5       |   33   |    2      | 
  |     11      |   32   |    3      | 
  |     12      |   33   |    2      | 
  |     13      |   33   |    2      | 
  |     19      |   69   |    3      | 
  </code></pre>
  
  <p>Expected Outcome:</p>
  
  <pre><code>|numberOfOrders|customer_id|
  |     2        |    1      | 
  |     1        |    2      | 
  |     2        |    3      | 
  </code></pre>
  
  <p>I tried this (and many more): </p>
  
  <pre><code>CREATE TABLE X AS
     SELECT 
         customer_id, 
         COUNT(order_id) AS `numberOfOrders`
     FROM Table1 T1 
     GROUP BY customer_id;
  </code></pre>
  
  <p>The problem is, that with this solution it counts every article not the number of orders: so the number of orders for customer 1 is 3 (not 2), for customer 2 is 3 (not 1)....</p>
  
  <p>How can I solve this for a big database with Mysql query? </p>