欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

sql獲取分組排序后數(shù)據(jù)的腳本

 更新時(shí)間:2014年01月20日 16:39:31   作者:  
這篇文章主要介紹了sql獲取分組排序后數(shù)據(jù)的腳本,大家參考使用吧

先上一段代碼,如下所示:

復(fù)制代碼 代碼如下:

select distinct 
b.OrgID,b.CompanyID,b.AreaID,b.CustChannelID,b.CustID,b.SaleTotalQty,
GETDATE() from KDS400TelSurveyCustAll_Temp  as tmp1 cross apply
(
select top 10 percent * from KDS400TelSurveyCustAll_Temp tmp2
where tmp1.OrgID=tmp2.OrgID and tmp1.CompanyID=tmp2.CompanyID
and tmp1.AreaID=tmp2.AreaID and tmp1.CustChannelID=tmp2.CustChannelID
and tmp2.CustChannelID in (1027,1028)
order by tmp2.OrgID,tmp2.CompanyID,tmp2.AreaID,tmp2.AreaType,tmp2.CustChannelID
) as b

這段代碼的意思是獲取取每個(gè)經(jīng)銷(xiāo)商在每個(gè)縣級(jí)城市中兩類(lèi)客戶(hù)
取各類(lèi)客戶(hù)的前3個(gè)月累計(jì)銷(xiāo)量排名在前10%的客戶(hù)進(jìn)行調(diào)查。

相關(guān)文章

最新評(píng)論