[SOLVED] How to make a sum selection of tuples with relational algebre | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

[SOLVED] How to make a sum selection of tuples with relational algebre

I have a table of customers and I want to know the total amount each client spent . I can make a sum for all the column amount, or just for one customer with the clause "where id_customer=x" but how to make the sum for each customer?

4th Jan 2018, 7:05 AM
Jacinto Lima
Jacinto Lima - avatar
3 Antworten
+ 15
use SUM and GROUP BY together SELECT customer_id, SUM(order_amount) FROM orders GROUP BY customer_id; this might help: https://www.w3resource.com/sql/aggregate-functions/sum-with-group-by.php
4th Jan 2018, 7:24 AM
Burey
Burey - avatar
+ 9
great :) marked as solved for anyone else who encounter this problem (and search for it <.<)
4th Jan 2018, 1:00 PM
Burey
Burey - avatar
+ 1
thank you guys, Burey have the solution.
4th Jan 2018, 12:17 PM
Jacinto Lima
Jacinto Lima - avatar