码迷,mamicode.com
首页 > 数据库 > 详细

Linq Sql

时间:2017-07-12 15:06:56      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:run   nbsp   int   smo   sum   sql   last   nis   select   

1.日期比较

var query = from order in dbContext.OrderTBs
where subProxyIDs.Contains(order.ProxyID)
&& firstDayOfPreviousMonth <= EntityFunctions.TruncateTime(order.FinishTime)
&& lastDayOfPrdviousMonth >= EntityFunctions.TruncateTime(order.FinishTime)
&& order.Status==(int)OrderStatus.Finished
select order
;

 

2.Group By

var query= from order in queryOrderList
group order by order.ProxyID
into g
where g.Sum(u => u.Num) >= 5
select g.Key
;

等价于

select t2.ProxyID from (
select sum(Num) num,t.ProxyID from OrderTBs t GROUP BY t.ProxyID
) t2
where t2.num>5

 

3.Group By having

待补充

 

Linq Sql

标签:run   nbsp   int   smo   sum   sql   last   nis   select   

原文地址:http://www.cnblogs.com/liandy0906/p/7155023.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!