我正在使用 Microsoft PUBS 数据库,其中有两个关系表发布者和 pub_info 发布者在 pub_id 字段上有主键,而 pub_info 有发布者表 pub_id 的外键
我正在尝试使用 linq 查询获取发布者表中可用但 pub_info 表中不可用的记录我知道 sql 中的查询
select pub_id from publisher where pub_id not in(select pub_id from pub_info);
var data =db.publisher.where(x=>db.pub_info.select(x1=>x1.pub_id).Contains(x)).Select(x.pub_id)
执行此查询时出错
但我无法了解在 linq 中生成相同的查询