我需要将sql查询转换为LINQ(查询语法),但我坚持使用IN语句。
如何在我的sql查询中为此WHERE子句编写LINQ:
WHERE OR_ID IN (SELECT DISTINCT OR_ID
FROM OR_ORDER_WORKER_HISTORY owHist
WHERE CLIENT_RATE_ID = @clientRateId)
答案 0 :(得分:1)
Where(x => db.OR_ORDER_WORKER_HISTORY
.Where(owHist=> owHist.CLIENT_RATE_ID == clientRateId)
.Select(owHist=> owHist.OR_ID)
.Distinct()
.Contains(x.OR_ID))