简体   繁体   中英

Complex Join Using LINQ EF

How can I join the two queries using LINQ to EF? I need the result set returned to me that includes joined data from the 2 queries combined.

1

select StockNo, Description 
from VehicleOption_New 
where StockNo in 
(
    select v.StockNo
    from Vehicles v
    join StatusDescription s 
    on v.Status = s.StatusId
    where NewOrUsed = 'n' and v.model = 'cts' 
)
and color is not null

2

select v.StockNo, s.StatusDescriptionText
from Vehicles v
join StatusDescription s 
on v.Status = s.StatusId
where NewOrUsed = 'n' and v.model = 'cts'  

一旦有了等效的EF查询,就可以使用Concat()Union()合并结果。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM