【发布时间】:2016-03-15 23:12:46
【问题描述】:
我对这个 Linq 查询做错了什么?
sql语句为:
SELECT
*
FROM
ReportGroups rg INNER JOIN ReportDefinitions rd on rg.ReportGroupID = rd.ReportGroupID
WHERE
rd.ReportGroupID = 5
LINQ:
var query = from rg in ReportGroups
join rd in ReportDefinitions on rg.ReportGroupID equals rd.ReportGroupID
.Where rd.ReportGroupID equals 5
select new
{
rg.ReportGroupName,
rd.ReportName
};
query.Dump();
【问题讨论】:
-
使用 where 和 == ,允许使用 where 的变体,但应该适合你