【发布时间】:2011-02-20 09:41:14
【问题描述】:
我有一个销售数据表,例如:
SELECT ItemCode, ItemDesc, TotalYearlySales, ShareOfBusiness, ABCIndicator
FROM Sales
WHERE Yir = Year(getdate())
AND Manth = Month(getdate())
ORDER BY TotalYearlySales DESC
ShareOfBusiness 计算为项目的(TotalYearlySales/SUM(TotalYearlySales))*100
对于总和为 SUM(ShareOfBusiness) 的 80% 的项目列表,ABCIndicator 是 A。 B 代表接下来的 15%,C 代表最后 5%。
如何获取每个项目的 ABCIndicator?
样本数据:
ItemCode ItemDesc TotalYearlySales ShareOfBusiness ABCIndicator
1234 Yellow Flute 3000 .36 A
1235 Brown Violin 2000 .24 A
1236 Silver Flute 1800 .21 A
1236 Pink Drums 1500 .18 B
【问题讨论】:
-
你能提供一些示例数据/输出吗?