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
- LINQ DateTimes between hours with duration
- Linq query result into two objects
- How to display the username after login
- LINQ with JOIN, GROUP, SUM() and return a new SELECT
- Linq to SQL Expression Properties That are Translatable to SQL
- Improve LINQ performance
- How to realize System.Linq.Expressions.Expression.Like
- Eager-loading using LINQ to SQL with Include()
- How to Include related objects in view using ADO.net
- LINQ: Query two tables in one query
- How to trim database data having multiple spaces?
- How to reduce multiple nested foreach blocks
- DateTime.TryParseExact method for string comparison
- LINQ to SQL decrypt value before populating object
- Joining/merging arrays in C#
- Linq to XML: can't find exact root in .xml file
- Code First EF: While searching database table is it possible to retrieve list of items it has in DataModel?
- How to convert an IQueryable<T> to a List<T>?
- Trying to write a delimited file using LINQ and XML, but can't make it work with strings
- How to call a method within .Select in Linq query without having to write select twice?
- Complex GROUP BY on DataTable
- Queryable.Aggregate is not working with null values
- Linq two table with sum column
- SQL Exception violation of primary key constraint when updating data
- Using Let in Lambda Expression while querying from a datatable
- Linq using Group by
- linq using order by, where, and select vb.net
- List grouping dynamically
- LINQ: take a sequence of elements from a collection
- Conditionally Insert Where Clause in LINQ Method Syntax with Select Many