首页 > 学院 > 开发设计 > 正文

exists用在linq上

2019-11-08 01:05:38
字体:
来源:转载
供稿:网友

SQL里面,有时候会用到exists或者not exists。

select * from yb t1 where not exists(select 1 from yb t2 where trunc(t1.yubaodate,'dd')=trunc(t2.yubaodate,'dd') and t1.yubaotype=t2.yubaotype and t1.id<t2.id)order by id desc;

然后,LINQ里怎么用?

var t1 = ybRepository.GetAll();var t2 = ybRepository.GetAll();var list = from s in t1 where !t2.Any(ss => ss.YUBAODATE.Date == s.YUBAODATE.Date && ss.YuBaoType == s.YuBaoType && ss.ID > s.ID) select s;

万幸,fluently nhibernate支持这种写法。


上一篇:Map

下一篇:比较两个数组的是否相等

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表