'How to use group by and ordery by with some operation in SQL? [closed]
Solution 1:[1]
Use group by
shop, order by
the sum()
of revenues for each group and limit
to 3:
select shop
from yourtable
group by shop
order by sum(price * sold_count) desc
limit 3;
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |