作者:月舞B的啊 | 来源:互联网 | 2023-10-10 12:19
IamdevelopinganASP.NETMVCapplication.IhavetwoqueriesandIwanttogetcommentrecordfrom
I am developing an ASP.NET MVC application. I have two queries and I want to get comment record from those two queries.
我正在开发一个ASP.NET MVC应用程序。我有两个查询,我想从这两个查询中获取评论记录。
Query one
查询一个
var poList = (from po in db.PurchaseOrders
where po.Id > 0
select po into newPO
select new { Name = newPO.PONo, Id = newPO.Id });
Query Two
查询二
var poList2 = (db.Employees.Where(x => x.Id == 25)
.Select(po => new { Name = po.PONo, Id = po.Id }));
Now I am trying to get common records from above two queries, using below statement
现在我尝试使用下面的语句从上面的两个查询中获取常见记录
poList.Join(poList2, a => a.Name, b => b.Name, (a, b) => new { Name = b.Name, Id = b.Id });
but I am not getting common records at all.
但我根本没有得到共同的记录。
What change I have to made in the statement ?
我必须在声明中做出什么改变?
2 个解决方案