我将以下SQL查询转换为LINQ格式,但它不会返回任何内容。
SELECT DISTINCT BASEFILTER.EVPTCODE
FROM CONFIGURE, BASEFILTER, SITE
WHERE CONFIGURE.BASEFILTER_ID = BASEFILTER.ID
AND CONFIGURE.SITE_ID = SITE.ID;
进入:
var basefilterDB = (from conf in lConfigures
join basef in lBasefilters on conf.BASEFILTER_ID equals basef.ID
join site in lSites on conf.SITE_ID equals site.ID
select new { basef.EVPTCODE }).Distinct();
当我在Oracle SQL Developer中运行SQL查询时,它会返回结果。
我不明白为什么它在linq中不起作用。这似乎是一个简单的请求......
非常感谢!
编辑-------------
答案:
var basefilterDB = (from conf in lConfigures
where conf.BASEFILTER_ID.Compare(conf.BASEFILTER_IDSource.ID)
select conf.BASEFILTER_IDSource.EVPTCODE).Distinct();
比较(此byte [])是一个比较两个字节[]的函数。