c# - tsql in lambda - select count group by -


how can query in lambda , linq?

select count(*) total, int_page         dbo.tbl_usuarios_online            group int_page                order total desc 

i not want use:

var lambda = ctx.tbl_usuarios_online.**sqlquery**() 

try this:

var result = ctx.tbl_usuarios_online.groupby(x => x.int_page)                                     .select(group => new { total = group.count(),                                                             int_page = group.key })                                     .orderbydescending(y => y.total); 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -