title: MySQL order by two fields, cluster fields
body: <p>I've been wondering how to order rows chronologically, but also keep rows with extra flag together.</p>
  <p>Specifically, I have table with orders</p>
  <p>Data:</p>
  <pre><code>| created     | customer | ...
  | 2020-01-01  | xyz      | ...
  | 2020-01-10  | abc      | ...
  | 2020-01-12  | xyz      | ...
  | 2020-01-15  | xyz      | ...
  | 2020-01-19  | abc      | ...
  | 2020-01-20  | abc      | ...
  
  </code></pre>
  <p>Desired result:</p>
  <pre><code>| created     | customer | ...
  | 2020-01-01  | xyz      | ...
  | 2020-01-12  | xyz      | ...
  | 2020-01-15  | xyz      | ...
  | 2020-01-10  | abc      | ...
  | 2020-01-19  | abc      | ...
  | 2020-01-20  | abc      | ...
  
  </code></pre>
  <p>So pretty much I need &quot;ORDER BY customers, created&quot;, but &quot;customers&quot; need to be ordered by their oldest order.</p>
  <p>I hope it makes sense. And thanks in advance for your help.</p>