title: SQL - select the first occurence of a customer's order when look at any order
body: <p>When looking at an order in my company's database, I would like to also find the order_id of the first order made by the customer who issued the order that I am currently looking at. </p>
  
  <p>Among other things, that would help me to know if the order that I am looking at is the first order ever made by the customer or not. </p>
  
  <ul>
  <li>The orders are stored in database.orders.The orders have a unique order_id (int 10) and contain a column customer_id. I usually sort the orders by different criteria (price, voucher code used, date, ...)</li>
  <li>The customers are stored in database.customers.The customers have a unique customer id (int 10).</li>
  </ul>
  
  <p>So for example when looking at all the orders issued by the customers who used a voucher with the code "VOUCHER123" or "COUPON123" and with a price above 1000 EUR, I would like to get</p>
  
  <pre><code>order_id  | customer_id | voucher_code | price | order_id_first_order_ever
  1000      | 50          | coupon123    | 1300  | 845
  1100      | 56          | voucher123   | 2005  | 1100
  </code></pre>
  
  <p>I do not really know how to do get the last column. Should I use inner requests? Is it feasible at all in just one request?</p>
  
  <p>I am quite puzzled by this and any assistance would be keenly welcome.</p>
  
  <p>I am using My SQL Workbench.</p>
  
  <p>Best regards,</p>
  
  <p>Jean-Baptiste </p>