score:3
Accepted answer
Are you using .NET 4? If so, try this:
var innerQuery = Query<JobImportResult>()
.GroupBy(jir=>jir.JobImport)
.Select(jir=>jir.Max(jr=>jr.Id))
.ToList();
var resultQuery = Query<JobImportResult>()
.Where(jir => innerQuery.Any(j => j == jir.Id)
&& jir.ImportFailureReason != null)
.Select(jir => jir.JobImport)
.ToList(); //only use this if you want to resolve the query
Or .NET 3.5 change the resultQuery
part to be:
var resultQuery = Query<JobImportResult>()
.Where(jir => innerQuery.Count(j => j == jir.Id) > 0
&& jir.ImportFailureReason != null)
.Select(jir => jir.JobImport)
.ToList(); //only use this if you want to resolve the query
Source: stackoverflow.com
Related Articles
- LINQ Source Code Available
- creating Linq to sqlite dbml from DbLinq source code
- NHibernate LINQ query performance, which code fragment is better?
- source code for LINQ 101 samples
- c# Linq or code to extract groups from a single list of source data
- Convert string[] to int[] in one line of code using LINQ
- Code equivalent to the 'let' keyword in chained LINQ extension method calls
- NHibernate vs LINQ to SQL
- Linq code to select one item
- Fetch vs FetchMany in NHibernate Linq provider
- How are people unit testing code that uses Linq to SQL
- Linq for NHibernate and fetch mode of eager loading
- Tradeoffs using NHibernate 3.0 QueryOver or LINQ provider
- Nhibernate Linq In Clause
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Getting count with NHibernate + Linq + Future
- NHibernate Second Level Cache With NHibernate Linq Provider 1.0
- Nhibernate 3 & LINQ
- How to do a case-insensitive string where in NHibernate Linq query?
- Syntax to execute code block inside Linq query?
- LINQ to Nhibernate duplicates joins
- Does NHibernate LINQ support ToLower() in Where() clauses?
- NHibernate efficient Delete using LINQ Where condition
- NHibernate or LINQ to SQL
- Linq to NHibernate : is it mature?
- Enumerable.Empty<T>().AsQueryable(); This method supports the LINQ to Entities infrastructure and is not intended to be used directly from your code
- NHibernate Linq provider and take() skip() with eager fetching
- NHibernate linq query with IUserType
- NHibernate Linq Group By fails to group properly in SQL Server
- Best open source LINQ provider
- Can I update the UI from a LINQ binding?
- Convert aggregate SQL query to LINQ
- How can I specify to use Linq ThenBy clause only when there is a tie?
- Using linq to combine objects
- Listing in WCF Entity
- Many to many relation between 2 tables(Entity framework)
- How can I pair up two items from a list using linq?
- How do I remove elements from a table?
- How do I return multiple xml elements/ attributes with linq, and create objects with them?
- Multiple Aggregation Levels in Linq
- Is new keyword required in linq when using a string
- C# SQL to LINQ pattern matching
- Sort search results by popularity using - C# ASP.NET
- Use Linq to break a list by special values?
- List Operations without ForLoops
- Any LINQ alternative for loop in reflection?
- Create grouping that includes missing keys
- Cannot insert the value NULL into column ... Exception issues
- Sum of TimeSpan in Entity Framework Core
- Making a LINQ query better