Athena - SQL 按订单数获取客户数
Athena - SQL to get Customer Count by Order Count
我有一个 table,客户数和订单数如下:
Customer Order_Count
A 5
B 7
C 5
D 4
E 1
F 1
G 1
如何编写 SQL 以按订单获取客户数量?结果如下:
Orders Customer_Count
7 1
5 2
4 1
1 3
您使用 Group by
并像这样获取客户数量:
select order_count, count(customer) customer_count
from your_table
group by customer
我有一个 table,客户数和订单数如下:
Customer Order_Count
A 5
B 7
C 5
D 4
E 1
F 1
G 1
如何编写 SQL 以按订单获取客户数量?结果如下:
Orders Customer_Count
7 1
5 2
4 1
1 3
您使用 Group by
并像这样获取客户数量:
select order_count, count(customer) customer_count
from your_table
group by customer