我需要从表中获取唯一记录并获得重复计数。我有疑问:
SELECT AwardReference.ownerID
FROM AwardReference
WHERE AwardReference.ownerType = 'song';
返回类似于:
的内容ownerID
1
2
4
4
5
5
5
我需要做类似的事情:
ownerID count
1 1
2 1
4 2
5 3
有谁知道怎么做?
此外,我必须使用MS ACCESS ...
执行此任务答案 0 :(得分:1)
SELECT AwardReference.ownerID ,
COUNT(*) AS count
FROM AwardReference
WHERE AwardReference.ownerType = 'song'
GROUP BY AwardReference.ownerID