当前位置:Gxlcms > 数据库问题 > Linq Sql

Linq Sql

时间:2021-07-01 10:21:17 帮助过:13人阅读

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   

人气教程排行