'SQL Union & join
I know there are a lot of topics about sql union/join but this is a special case because I would like to compare the expenses of each customer in two different stores. I'm using the "Sakila" sample database
SELECT customer.last_name AS prenom,
sum(payment.amount) AS total_payé
FROM payment
INNER JOIN customer ON payment.customer_id = customer.customer_id
WHERE store_id = 1
LIMIT 3
UNION ALL
SELECT customer.last_name AS prenom,
sum(payment.amount) AS total_payé
FROM payment
INNER JOIN customer ON payment.customer_id = customer.customer_id
WHERE store_id = 2
LIMIT 3
but have a error, i need help :(
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
