score:1
Accepted answer
you can try the following sample code:
var results = _customertable.groupby(c => new {c.date, c.customer_type_id}).select(g => new {g.key.date, g.key.customer_type_id, mycount = g.count()});
using this way you can get number of recors per date
and customer_type_id
.
Source: stackoverflow.com
Related Query
- Linq to SQL get distinct records grouped by date
- SQL to LINQ to get all records that match all values
- How to get SQL query into LINQ form in C# code
- Linq Query to Get Distinct Records from Two Tables
- Linq To Sql - How to get # of inserted records
- Linq To Sql - Get week day name from date
- How to get the distinct record name and its each record count to bind to gridview in C# using Linq from SQL Server
- C# Linq to Entities get records where date range contains dates in the current month
- Linq query to order a list based on date and get distinct
- C# linq get records where date range is in a selected week
- Linq to SQL | Top 5 Distinct Order by Date
- Select distinct and date difference in Linq to SQL from two dataTables
- What SQL query or LINQ code would get the following data?
- how to get latest distinct 10 records without null values using linq query
- LINQ to SQL - Distinct records across multiple columns
- Get Records from table where quantity is not between fromquantity and ToQuantity using Linq to SQL
- Using Linq to Get a List of Objects to a Distinct Grouped List
- Linq to Sql get today date only data from db
- LINQ or SQL to get records closest to specific time per day per account
- Does Linq in Entity Framework code first use SQL or does it get the whole table first?
- My Linq to Sql Insert code seems to work fine but I don't get a record in the database
- LINQ to SQL ,Join tables to get distinct result?
- Using LINQ to SQL to get distinct value of an IQueryable resultset
- How to get records affected by an update stored procedure in LINQ to SQL
- How to get all records from thisa year onwards from LINQ to SQL model?
- Linq query to get distinct object based on date and priority
- How to left join tables in LINQ TO SQL to get associated records
- Get records from datatable grouped by date and every two hour
- How to get group of records with latest date using Linq to Entities
- Get all records (from single table) by latest date using LINQ
More Query from same tag
- Create array from nested lists
- Summing up property values using LinQ
- Load only some elements of a nested collection efficiently with LINQ
- How to fetch unique objects using Linq
- Can this LINQ query be simplified?
- If Entity Framework is meant to work with POCOs, then why the dependency on IObjectSet?
- How to get keys and values from Appsettings of Config file in Linq
- Specify condition with FirstOrDefault (in Method Chaining Approach)
- Anonymous Types in a repeater - Eval? Dynamic?
- C# test if variable assigned
- use external function in LINQ
- Linq Dynamic Group Key
- LINQ IEnumerable<T> Memory Structure
- How to get distinct values in string array via Linq?
- ASP.NET MVC and Linq, when to use?
- Specifically increase an ID value depending on A Foreign Key
- In generic list, List.Last() throws System.IndexOutOfRangeException even after check of Count
- "<?xml version="1.0"?>" c# linq or XDocument remove encoding=UTF-8
- Linq to SQL VS Entity Framework
- LINQ Query over heterogeneous collection of different types with same base class
- Dynamic Linq SearchFor from entities by Passing Tablename,ColumnName and value as parameter
- How to convert SELECT TOP 1 WITH TIES query to LINQ C#?
- How to remove extra hyphens from string in c#?
- How to assign one value to multiple keys in a C# dictionary?
- Filter xml using xpath and linq (price with decimal separator and thousands separator spanish) VB. NET
- Nhibernate linq fetch in subclass
- LINQ to select Leads where FirstName.length < 6
- WEB API IQueryable skip() take()
- Get a new list of a custom type using a Group by
- Formatting LINQ Query Result Set