score:2
Accepted answer
select
sum(case when typeofuseage = 'a' then 1 else 0 end) as typeacount
, sum(case when typeofuseage = 'b' then 1 else 0 end) as typebcount
from mytable
score:1
var entity=new myentity()
entity.typeacount = data.count(a => a.typeofusage == "a"),
entity.typebcount =data.count(b => b.typeofusage == "b")
Source: stackoverflow.com
Related Query
- Map Linq groupby count to C# entity
- LINQ with groupby and count
- Cleanest Way To Map Entity To DTO With Linq Select?
- GroupBy String and Count in LINQ
- Linq Query Count and GroupBy
- Linq / Entity Group by then count those groups
- How to do a LINQ query for count of entity whose owner == current user?
- Linq to Entity Groupby and concatinate column
- EF core Linq groupby and having sum count - could not be translated and will be evaluated locally
- Entity Framework/ Linq - groupby and having clause
- LINQ GroupBy Count
- GroupBy and Count by condition Entity Framework
- Linq GroupBy Clause not including items with zero count
- Linq groupby list matching and count
- GroupBy using LINQ but base distinct on another column, and still be able to count other records
- Linq groupby and count operations in mvc
- Different result in Linq with GroupBy and Count
- Count child matches in linq Entity Framework
- GroupBy and Count with condition using LINQ
- Entity Framework - LINQ Expression Map many to many
- Convert SQL Distinct, Count & GroupBy to a Linq query with Navigation
- SELECT result map to entity in Dynamic Linq in Entity Framework Core
- LINQ Select Statement to Map Entity Using Recursion
- GroupBy and Count using LINQ
- C# Linq XML GroupBy OrderBy get count
- Linq Age GroupBy Aggregate Count
- .net linq entity framework groupby
- Linq query select count into same entity
- LINQ Entity Framework - COUNT AND QUERY
- How make a LINQ Select, GroupBy and Count from a List of Lists?
More Query from same tag
- What is the difference between Equals and = in LINQ?
- Parsing Conditional Expressions to String
- What is the correct datetime-cast for a QueryType in EFCore?
- Get records from Generic Object using LINQ C#
- Does "where" position in LINQ query matter when joining in-memory?
- Get Xml content into a string from a subchild using c#
- How to get Resharper to convert back to a foreach loop
- Bind WPF DataGrid to LINQ Query (Entity Framework)
- How to get no_of_products based on cus_id
- LINQ select property from object in query
- Save a file from SQL Database on button click using Linq in ASP.NET
- How to use LINQ to order within groups
- Left Join 2 tables with main table using LINQ
- sql Left join with linq lampda expression
- Extending Telerik client template column and getting the values passed through
- How to optimize this expression ? LINQ?
- When I use an IQueryable function, it significantly increase the time of the query
- Random LinQ-SQL errors and sudden database closing
- LINQ JOIN with WHERE condition
- How to turn a collection of a flat object into a collection of an object with a child collection
- .NET Linq. Confusion about SelectMany
- Unique List, but keep blank lines
- No coercion operator is defined between types 'System.Guid' and 'System.String'
- WHERE not found in LINQ query
- How to show LINQ data in view in asp.net mvc?
- How to get matches between collections of different types?
- Access to file is denied when LINQ is used instead of a foreach
- Union tables with LINQ query for custom Model
- What's a good "mobile" .NET database that supports LINQ?
- How do I get other table information from linq ".include"