score:0
Accepted answer
var list = (from tbbthread in context.bthread
group tbbthread by tbbthread.id into btmp
orderby btmp.sum(x => x.count)
select new bviewmodel
{
id = btmp.key,
count = btmp.sum(x => x.count)
}).take(10).tolist();
Source: stackoverflow.com
Related Query
- Linq group by and order by sum
- Linq order by, group by and order by each group?
- Using LINQ to group by multiple properties and sum
- Multiple group by and Sum LINQ
- Entity Framework - Linq query with order by and group by
- Linq Query with SUM and ORDER BY
- Linq to SQL using group By, and order by count
- LINQ Query with GROUP and SUM
- Linq to SQL Group by and Sum in Select
- Sum and group linq
- Linq to SQL Left Join, Order and Group By Count
- LINQ with Lambda expression - Join, Group By, Sum and Count
- How do I order the elements in a group by linq query, and pick the first?
- Converting SQL containing top, count, group and order to LINQ (2 Entities)
- Linq Group by and sum problems
- LINQ group by and order by in C#
- LINQ join, group and sum (or any aggregate)
- Linq Group by and Order by
- Linq - how to group by a 'let' value and sum another 'let' value
- LINQ group by date descending, and order by time ascending
- How to group by and sum for every 7 days using linq lambda?
- How should i use group by and sum on different values of list of models using linq
- linq sum and group
- Prevent duplicate sum in linq group and join
- group by and sum using linq
- Use LINQ to group by one field, sum based on group AND store on Dictionary
- Linq query with GROUP BY on multiple fields, SUM and COUNT
- LINQ to SQL - order by, group by and order by each group with skip and take
- Linq to SQL Group by and sum in select with entity
- Linq - Group By Id, Order By and Then select top 5 of each grouping
More Query from same tag
- NullRefereceException when parsing a tweet
- OrganizationServiceContext.CreateQuery vs Fetch
- Why is this function faster and why are multiple enumerations of it faster than the first?
- What in Linq.Max implementation is the bottleneck?
- Linq to XML treating results individually instead of listing
- Linq Select row Where date in Current month
- LINQ contains one match from array of strings
- Join on Condition With Linq Methods
- Custom Linq Query where property name is unknown at compile time
- linq to xml access data based on field attribute
- Linq query to join tables on multiple conditions C#
- Convert Igrouping Anonymous type to List of string by using lambda
- query dataset using LINQ
- How to write Outer Join using LINQ
- Constructing dynamic linq queries based on user input
- How to map two lists using linq
- How do I put distinct values from a LINQ query into a list?
- WPF - The Binding to ComboBox returns only the characters from the first data row
- Should I use Single() or SingleOrDefault() if there is a chance that the element won't be found?
- Double select in list
- Globally Override Linq to SQL to save object strings as Empty Strings instead of NULL
- How to use CAST,CONVERT and isNULL in LINQ?
- How to get the item before current and after current in a dictionary with Linq / C#?
- How do I query SQL Server for a record with multiple key/value pair constraints?
- Sorting an ArrayList
- Access Object through foreign key c#
- XMLResponse element show in list
- Generate an XSD using LinqToXml
- List sum too large, throwing overflow exception
- 'Type' is a variable but is used like a Type error with LINQ