是否有一个SQL查询可以提供与以下LINQ语句相同的结果?
DataTable dtAll1 = userData1.AsEnumerable()
.Where(ra => !userData2.AsEnumerable()
.Any(rb => rb.Field<string>("A") == ra.Field<string>("B")))
.CopyToDataTable();
答案 0 :(得分:0)
SELECT
*
FROM
userData1 AS ra
WHERE
NOT EXISTS (SELECT * FROM userData2 AS rb WHERE ra.B = rb.A)
(从EXISTS
更新为NOT EXISTS
。)