我有一张像这样的桌子
id area Count1
39 AB
40 AB
41 AB
42 AB
82 Ag
83 Ag
98 Ai
100 Ai
183 Am 我需要在另一个字段中计算重复值的计数,比如'count1‘,因为id很重要
我需要这样的答案
id area Count1
39 AB 1
40 AB 2
41 AB 3
42 AB 4
82 Ag 1
83 Ag 2
98 Ai 1
100 Ai 2
183 Am 1我正在获取重复值的计数,目前我正在使用ms access 2007。
谢谢
发布于 2014-05-20 19:31:03
您可以使用相关子查询来完成此操作:
select id, area,
(select count(*)
from table as t2
where t2.area = t.area and
t2.id <= t.id
) as Count1
from table as t;https://stackoverflow.com/questions/23758545
复制相似问题