使用Contains和bigint的嵌套LINQ查询
这是我想要的SQL ClearinghouseKey是一个bigint: 内部查询是直接的,并在LINQPad中给出正确的结果:使用Contains和bigint的嵌套LINQ查询,linq,contains,biginteger,nested-query,Linq,Contains,Biginteger,Nested Query,这是我想要的SQL ClearinghouseKey是一个bigint: 内部查询是直接的,并在LINQPad中给出正确的结果: var innerQuery = (from p in Projects join l in LandUseInProjects on p.ClearinghouseKey equals l.ClearinghouseKey where locations.Contains(p.ProjectLo
var innerQuery = (from p in Projects
join l in LandUseInProjects on p.ClearinghouseKey equals l.ClearinghouseKey
where locations.Contains(p.ProjectLocationKey)
&& (landuses.Contains(l.LandUseKey))
select new { p.ClearinghouseKey }).Distinct();
但是外部查询给出错误:无法从用法推断来自…Contains.的类型参数:
var returnQuery = from o in OperOutput
where (innerQuery).Contains(o.ClearinghouseKey)
select o;
是因为ClearinghouseKey是一个bigint吗?还有其他方法写这个查询吗
谢谢,
珍妮不要使用匿名类型:
select new { p.ClearinghouseKey })
应该是
select p.ClearinghouseKey)
也考虑使用任何替代而不是包含,我没有理由选择一个而不是另一个。
where innerQuery.Any(i => i == o.ClearinghouseKey)
不要使用匿名类型:
select new { p.ClearinghouseKey })
应该是
select p.ClearinghouseKey)
也考虑使用任何替代而不是包含,我没有理由选择一个而不是另一个。
where innerQuery.Any(i => i == o.ClearinghouseKey)