0

我有一张桌子"Customers"

它有一些列"customerid","CreatedDate"

CreatedDate是客户的加入日期。

现在我想获得20当年最先加入的顶级客户。

意味着如果 25 名客户在一月份加入,30 名客户在二月份加入,那么我希望获得前 20 名在一月份加入的客户。

提前致谢。

4

2 回答 2

3
select top 20 * 
from customers
where year(createddate) = 2013
order by createddate 
于 2013-10-26T10:50:00.003 回答
-1

select cust_name,count(cust_name) no_of_orders from your_table group by cust_name order by 2 desc

于 2021-04-05T04:58:30.293 回答