Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the jwt-auth domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/forge/wikicram.com/wp-includes/functions.php on line 6121
Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wck domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/forge/wikicram.com/wp-includes/functions.php on line 6121 An important feature of the Carnot cycle is that | Wiki CramSkip to main navigationSkip to main contentSkip to footer
Suppоse yоu hаve а dаtabase cоntaining the following two small tables of customers and transactions: table name: customers, primary key = customer_id customer_id customer_name membership 1 Bob basic 2 Larry basic 3 Judy elite 4 Doug elite 5 Rachel basic table name: transactions, primary key = transaction_id transaction_id customer_id transaction_date transaction_amount 1 3 '2018-04-01' 478.02 2 3 '2018-05-15' 15.11 3 4 '2018-06-01' 167.89 4 4 '2018-06-01' 1004.21 5 4 '2018-07-04' 452.52 6 1 '2018-08-21' 19.01 The retailer would like to view the total transaction amount for each customer, as shown below. customer_id customer_name membership total_amount 1 Bob basic 19.01 2 Larry basic [null] 3 Judy elite 193.13 4 Doug elite 1624.62 5 Rachel basic [null] Complete the missing part of the query below. Note that 'temp1' is a Common Table Expression (CTE): __(1)__ temp1 AS (SELECT customer_id, membership, sum(transaction_amount) AS total_amountFROM transactions GROUP BY customer_id, membership )SELECT __(2)__, customer_name, membership, total_amountFROM customer AS cLEFT JOIN __(3)__ON c.customer_id = temp1.customer_id ;