得到datatable中重复的数据并显示 怎么得到datatable中重复的数据并显示,要是用两个for循环,这样会慢很多。有没有其他方法? [解决办法] 是要取消某个字段的重复项?然后绑定? [解决办法] 创建datatable2 你所谓重复是指哪个字段重复 group by 一下 统计出来重复的数据 放到datatable2中 [解决办法]
根据金额和卡号查询出表中的所有重复的记录? 可以考虑用这个查询语句
select col_1,col_2,count(1) from table group by col_1,col_2 having count(1) >1;
[解决办法] 是说导入的时候不能导入重复数据么?那就在insert的时候判断一下,用 if not exists (select 1 from table where id =?id) insert into table ..... else ..... [解决办法] 可以用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, 。。。 };