各位大神,要求求出,2016年1-5至2016-02-05 商品名称出现过2次以上,且单笔数量大于7,结果再要求排名,符合要求出现次数及总次数,且显示总数谢谢
房号 日期 商品名称 数量1 2016-01-01 00:00:00.000 a 1.00
2 2016-01-02 00:00:00.000 a 2.00
3 2016-01-03 00:00:00.000 b 3.00
4 2016-01-04 00:00:00.000 c 4.00
5 2016-01-05 00:00:00.000 d 5.00
6 2016-01-06 00:00:00.000 e 6.00
7 2016-01-07 00:00:00.000 f 7.00
8 2016-01-08 00:00:00.000 a 8.00
9 2016-01-09 00:00:00.000 a 9.00
10 2016-01-10 00:00:00.000 a 10.00
11 2016-01-11 00:00:00.000 b 11.00
12 2016-01-12 00:00:00.000 a 12.00
13 2016-01-13 00:00:00.000 c 13.00
14 2016-01-14 00:00:00.000 d 14.00
15 2016-01-15 00:00:00.000 f 15.00
16 2016-01-16 00:00:00.000 g 16.00
17 2016-01-17 00:00:00.000 h 17.00
18 2016-02-01 00:00:00.000 a 18.00
19 2016-02-02 00:00:00.000 a 2.00
20 2016-02-03 00:00:00.000 b 3.00
21 2016-02-04 00:00:00.000 c 3.00
22 2016-02-05 00:00:00.000 d 3.00
23 2016-02-06 00:00:00.000 a 4.00
24 2016-02-07 00:00:00.000 b 5.00
25 2016-02-08 00:00:00.000 b 6.00
26 2016-02-09 00:00:00.000 b 6.00
27 2016-02-10 00:00:00.000 c 6.00
28 2016-02-11 00:00:00.000 d 7.00
29 2016-02-12 00:00:00.000 e 7.00
30 2016-02-13 00:00:00.000 f 7.00
结果如下:
商品名称 数量 出现次数 名次
c 13 1 1
d 14 1 2
f 15 1 3
g 16 1 4
h 17 1 5
a 18 1 6
a 39 4 7
总计 132 10
[此贴子已经被作者于2023-2-21 15:48编辑过]