我有这样的数据表
ColA ColB ColC
Friends Columbus US
Friends London UK
Business Paris France
Personal Moscow Russia
Friends Sydney Australasia
Personal Beijing China
Relatives KL Malaysia
我希望使用LINQ基于第一列获取重复行。
结果应该是这样的
ColA ColB ColC
Friends Columbus US
Friends London UK
Personal Moscow Russia
Friends Sydney Australasia
Personal Beijing China
怎么做?
答案 0 :(得分:0)
这类似于你想要做的事情:
from b in db.Tab
group b by b.Name into grp
where grp.Count() > 1
select grp.Key
答案 1 :(得分:0)
你可以试试这个:
select * from table1
where ColA IN (Select ColA from table1 group by colA
having Count(ColA) > 1)
选中 SQL FIDDLE