I’ve been required while online self learning to do as title shows.
this is the info of the quesion:
Accounting
Instruction
Write a query to select the amount of sales by country. Order the result by descending amount.
Produce exactly two columns with the country code and the sales amount, as shown in the example below. Column aliases are not important.
Example
+———+———–+
| country | total |
+———+———–+
| FR | 318421.25 |
| IT | 74757.74 |
| ES | 65175.77 |
+———+———–+
This is what I tried (tried multiple ways)
`SELECT users.country as ‘Country’, SUM(products.price * order_items.quantity) as ‘Total Sales’
FROM users INNER JOIN order_items ON users.id = order_items.order_id INNER JOIN products ON order_items.product_id = products.id
ORDER BY users.country DESC;`
And I get this result, but im supposed to get the other countries as well, not just DE.
+———+————-+
| Country | Total Sales |
+———+————-+
| DE | 363282.61 |
+———+————-+
Any help appreciated, thank you.