开发者

Help with a LINQ Query

开发者 https://www.devze.com 2023-03-22 00:12 出处:网络
I need some help developing a two linq querys. this is my table: Idint ComputadorIDint UtilIDint UtilizadorIdint

I need some help developing a two linq querys. this is my table:

Id              int 
ComputadorID    int 
UtilID          int 
UtilizadorId    int 
DataInicio      datetime    
DataFim         datetime    
Removido        bit 

wh开发者_StackOverflow社区at i want to do is getting a two list: First list gets the count by hours; Second list gets the count by day;

in the two list only count when datafim is inserted how can i do it?


Assuming DataInicio is your colum that has the days and hours you could try something like this

var result = from d in yourContextVar.YourTable
group d by d.DataInicio.Day into g
select new { Day=g.Key, Count=g.Count() };
0

精彩评论

暂无评论...
验证码 换一张
取 消