我有两张桌子Cars
和Booking
.
我想要以下 SQL 查询在 LINQ 中的等价物,我正在努力解决它
SQL查询是:
SELECT *
FROM CARS
WHERE Car_id NOT IN (SELECT Car_Id
FROM Bookings
WHERE JourneyCompletion = 'OnGoing');
结果应该是汽车串列。如何在 Linq 中实作这一点?
uj5u.com热心网友回复:
试试下面的代码:
var Q1 = (from row in DbContext.Bookings where row.JourneyCompletion=='OnGoing' select row).ToList();
var Q2 = (from row in DbContext.CARS.where(n=> !n.Car_Id.Contains(n.Car_id))).ToList();
0 评论