C# 加入多个表仅获取克隆需求而非供应
我一直想得到一个不在表No.PlantSupply of FId=1中的CId条目,我想得到一个要求输入但未提供的克隆C# 加入多个表仅获取克隆需求而非供应,c#,asp.net,entity-framework,entity,C#,Asp.net,Entity Framework,Entity,我一直想得到一个不在表No.PlantSupply of FId=1中的CId条目,我想得到一个要求输入但未提供的克隆 Plantdemand Id | FId | FY ------------------ 22 | 1 | 2011-15 No.PlantDemand Id | PDId | CId | Demand ------------------------ 1 | 22 | 1 | 100 2 | 22 | 2 | 2
Plantdemand
Id | FId | FY
------------------
22 | 1 | 2011-15
No.PlantDemand
Id | PDId | CId | Demand
------------------------
1 | 22 | 1 | 100
2 | 22 | 2 | 200
3 | 22 | 3 | 300
^
"- Id of plantDemand
PlantSupply
Id | FId | DId | FY
---------------------
11 | 1 | 22 | 2012-13
^
"-Id of plantDemand
No.PlantSuply
ID | PSId | CId | Supply
---------------------------
1 | 11 | 1 | 10
2 | 11 | 2 | 10
^
"--Id of PlantSupply
请让我知道,如果有人知道我如何才能得到克隆这些不是只提供了一个需求条目
var getNoofPlantDemand = (from r in getdemand
join nd in context.tbl_NoOfPlantDemanded on r.PlantDemandId equals nd.PlantDemandId into list1
from l1 in list1.DefaultIfEmpty()
join p in context.PlantationTypes on r.PlantationTypeId equals p.Id into list3
from l3 in list3.DefaultIfEmpty()
select new
{}).toList()
var getCloneDemand = (from r in getNoofPlantDemand
join cl in context.Clones on r.CloneId equals cl.Id into list4
from l4 in list4.DefaultIfEmpty()
var getPlantSupply = (from r in getCloneDemand
join s in context.PlantSupply on r.PlantDemandId equals s.DemandId into list
from l1 in list.DefaultIfEmpty()
join ns in context.No.PlantSupply on l1.Id equals ns.PSId into list1
from l2 in list1.DefaultIfEmpty()
where r.CloneId != l2.CloneId && r.PlantDemandId==l1.DemandId && r.PlantationTypeId == l2.PlantationTypeId
select new
{}).toList()
my requirement:
Id | FId | FY | CId | Demand
22 | 1 | 2011-012 | 3 | 300