答案 0 :(得分:1)
根据您的搜索结果,您只需要一个简单的group by
:
select name, year, count(*)
from [table]
group by name, year;
一个语句不能返回两个不同的标题。我的意思是,你可以运行两个查询:
select name, year, count(*) as NumDuplicates
from [table]
group by name, year
having count(*) > 1;
select name, year, count(*) as NumNonDuplicates
from [table]
group by name, year
having count(*) = 1;