Sir/Ma'am I want to convert the below mentioned SQL query into LINQ how can I achieve this.
先生/女士我想将下面提到的SQL查询转换为LINQ,我该如何实现。
select * from dbo.Main as M
where M.ApplicationId in
(select distinct R.ApplicationId from tblRecomSanctionedDetail R
where R.UpdateByUserId = 1011 )
tried using my limited knowledge with LINQ but could not get the output.
尝试使用我对LINQ的有限知识,但无法获得输出。
1 个解决方案
#1
1
I don’t have anywhere to test this at the moment but I think roughly it would be something like…
我目前没有任何地方可以对此进行测试,但我认为它大概会像...
var applicationIds = tblRecomSanctionedDetailQueryable.Where(x => x.UpdateByUserId == 1011).Select(x => x.ApplicationId);
var result = mainQueryable.Where(x => applicationIds.Contains(x.ApplicationId)).ToList();
#1
1
I don’t have anywhere to test this at the moment but I think roughly it would be something like…
我目前没有任何地方可以对此进行测试,但我认为它大概会像...
var applicationIds = tblRecomSanctionedDetailQueryable.Where(x => x.UpdateByUserId == 1011).Select(x => x.ApplicationId);
var result = mainQueryable.Where(x => applicationIds.Contains(x.ApplicationId)).ToList();