1

我有这样的查询

SELECT id 
FROM params 
WHERE valid=1 
    AND id NOT IN (SELECT pid 
                   FROM clientparams 
                   WHERE update = 0 AND client=15) 
LIMIT 25

我正在尝试将其转换为等效的实体框架:

IQueryable<Params> parame = db.Params.Where(p => p.valid.Equals(1)).Except(....);

但是我被困在我需要为子查询做一个等价的地方

任何想法如何解决它?

4

1 回答 1

2

尝试这个

IQueryable<Params> parame = db.Params.Where(p => p.valid.Equals(1) && 
    !db.clientParams.Any(e => e.pid == p.id && e.update == 0 && e.client  == 15))
                                     .OrderBy(e => e.id) //Order by any field.
                                     .Take(25);
于 2013-10-28T17:10:29.307 回答