var query = from t in dtFin.AsEnumerable()
group t by new { t1 = t.Field<string>("保单号"), t2 = t.Field<string>("批单号"), t3 =t.Field<object>("保费金额") } into m
select new
{
amout = m.First().Field<object>("保费金额"),
pob = m.Key.t1,
pop = m.Key.t2,
rowcount = m.Count()
};
foreach (var q in query)
{
if (q.rowcount > 1)
{
//有重复
}
}
可以用linq
select col_1,col_2,count(1) from table group by col_1,col_2 having count(1) >1;
var query=from d in dt.AsEnumrable()
group d by new{ d.Field<string>("卡号"), d.Field<decimal>("金额")} into g
where g.Count() >= 10
select new
{
g.Key,
。。。
};