110,534
社区成员
发帖
与我相关
我的任务
分享
var query = (from DataRow r in yourTable.Rows
let a = (string)r["项目A"]
where (from DataRow r2 in yourTable.Rows
where r2 != r && (string)r2["项目A"] == a
select r2).Any()
select a).Distinct();
这显然不需要Group by运算啦。var query = from DataRow r in yourTable.Rows
group r by (string)r["项目A"] into g
where g.Count() > 1
select g.Key;
这当然也是循环,只不过非常清晰而已。
DataTable dt1 = dt.DefaultView.ToTable(true, new string[] { "no" });
DataTable dt2 = dt.DefaultView.ToTable(true, new string[] { "no","name" });
if(dt1.Rows.Count != dt2.Rows.Count)
{
//项目A中有对应多个B项目
}
else
{
//反之
}