求助子查询 in 怎么写 返回

SqlSugar 老数据
1 2332
该叫什么 vg 发布于2018/5/5
悬赏:5 飞吻

想拼接一个子查询  select  * from tab  where id in (select id from tab2 )


用框架


WhereIf(1=1,n => n.Id == SqlFunc.Subqueryable<tab2>().Where(c => c.pid == 0).Select(c => c.id))

为什么生成的Sql 都是 select  * from tab  where id = (select top 1 id from tab2 )


请问 我要的  in  怎么写

因为需要用到whereif  所有没有用直接用in

热忱回答1

  • 程序 程序 VIP0
    2018/5/8

    SqlFunc.Subqueryable<tab2>().Where(c => c.pid == 0).Select(c => c.id).Contains(n.Id)

    0 回复