我有下面对应的数据2列:如何把在集团计数器通过使用SQL
Name Category
A SL
B SL
C SL
A SL
A SL
C SL
现在在我的剧本
,我组他们在类别知道他们发生了多少次反:
select Name, count(*) from Customer
group by Category
,但我想他们有多少次出现在查询像下面计数:
Customer Number#
A 1 (means its the first time it occurs)
A 2 (means its the second time it occurs)
A 3 (means its the third time it occurs)
。 ...等等
B 1 (means its the first time it occurs)
C 1 (means its the first time it occurs)
C 2 (means its the second time it occurs)
对不起,有点困惑,希望大家明白。
谢谢。
什么RDBMS您使用的? – Mureinik 2014-09-02 06:28:37
即时通讯使用MS SQL – 2014-09-02 06:29:54