99999久久久久久亚洲,欧美人与禽猛交狂配,高清日韩av在线影院,一个人在线高清免费观看,啦啦啦在线视频免费观看www

熱線電話:13121318867

登錄
2022-09-09 閱讀量: 762
SQL德邦面試題

image.png

如圖所示,按照要求用SQL查詢:

select * from 攬收表;

select 單量,count(*) as 客戶數(shù)

from

(select

客戶id,

count(distinct 運(yùn)單號) as 下單次數(shù),

case when count(distinct 運(yùn)單號)<=5 then '0-5'

when count(distinct 運(yùn)單號)<=10 then '6-10'

when count(distinct 運(yùn)單號)<=20 then '11-20'

else '20以上'

end as 單量

from 攬收表

where month(創(chuàng)建日期)=5

group by 客戶id) as t

group by 單量;

#先按照給定的區(qū)間,將去重的運(yùn)單號劃分到其中,之后再對區(qū)間分組求和,用case when 邏輯更清晰,用if判斷也可


23.5688
0
關(guān)注作者
收藏
評論(0)

發(fā)表評論

暫無數(shù)據(jù)
推薦帖子