Note that there are some explanatory texts on larger screens.

plurals
  1. POMySQL - Select all customers and each customer's total orders and total value
    text
    copied!<p>For each customer, I want to return: id, name, total_orders, total_value</p> <p>Customers:</p> <pre><code>╔════╦═════════════╗ ║ ID ║ NAME ║ ╠════╬═════════════╣ ║ 1 ║ John Smith ║ ║ 2 ║ Jim Jimmers ║ ╚════╩═════════════╝ </code></pre> <p>Orders:</p> <pre><code>╔═══════╦══════════╦═══════╗ ║ ID ║ CUSTOMER ║ VALUE ║ ╠═══════╬══════════╬═══════╣ ║ 34656 ║ 1 ║ 20 ║ ║ 37345 ║ 2 ║ 25 ║ ║ 38220 ║ 1 ║ 15 ║ ║ 39496 ║ 1 ║ 38 ║ ║ 41752 ║ 1 ║ 9 ║ ║ 43734 ║ 2 ║ 20 ║ ╚═══════╩══════════╩═══════╝ </code></pre> <p>How do I select a result like:</p> <pre><code>╔════╦═════════════╦═════════════╦═════════════╗ ║ ID ║ NAME ║ TOTALORDERS ║ TOTAL_VALUE ║ ╠════╬═════════════╬═════════════╬═════════════╣ ║ 1 ║ John Smith ║ 4 ║ 82 ║ ║ 2 ║ Jim Jimmers ║ 2 ║ 45 ║ ╚════╩═════════════╩═════════════╩═════════════╝ </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload