2.1 COUNT DISTINCT

按月统计下单的客户数量
SQL

SELECT count(DISTINCT CustomerID) num,year(OrderDate) years, 
  month(OrderDate) months 
FROM Orders
WHERE OrderDate>='2022-01-01' and EmployeeID=5
GROUP BY year(OrderDate), month(OrderDate)
ORDER BY years,months

SPL

A
1 >st=date(“2022-01-01”), start=days@o(st)
2 =file(“Orders.ctx”).open().cursor(OrderDate,CustomerID;OrderDate>=start && EmployeeID==5)
3 =A2.groups(year(OrderDate):years,month(OrderDate):months;icount(CustomerID):num)

A3 用 icount 计算唯一计数

以下是广告时间

对润乾产品感兴趣的小伙伴,一定要知道软件还能这样卖哟性价比还不过瘾? 欢迎加入好多乾计划。
这里可以低价购买软件产品,让已经亲民的价格更加便宜!
这里可以销售产品获取佣金,赚满钱包成为土豪不再是梦!
这里还可以推荐分享抢红包,每次都是好几块钱的巨款哟!
来吧,现在就加入,拿起手机扫码,开始乾包之旅



嗯,还不太了解好多乾?
猛戳这里
玩转好多乾