score:2
Accepted answer
do something like this : (update column name as per yours)
var query = (from c in testresult
join tbl2 in testresultrelated on c.id equals tbl2.testresult
where c.user_login_name = 'emilwkj' and tbl2.data != ''
orderby tbl2.data
group tbl2 by tbl2.data into g
select new
{
id = g.key.id,
name = g.key.name,
testresultrelated = g
})
.distinct() //.distinct(x=>x.somecolumn)
.orderbydescending(x => x.date);
.take(10)
score:0
as we understand you are using efcore and dbcontext heaving testresult and testresultrelated table.
here is the code of problem that we understand from your question.
var db=new dbcontext();
var result = (from a in db.testresult
join b in db.testresultrelated on a.id equals b.testresult
where b.path == "testresultrelatedadditionaldata.softwareversion"
& a.user_login_name == "emilwkj" & b.data!=" "
group b by b.data into item
orderby item.max(e=>e.start_date_time) descending
select item)
.take(10);
Source: stackoverflow.com
Related Query
- SQL subquery result in LINQ and Entity Framework Code First
- how to select data by linq in many-to-many relationship in First code Entity framework 5
- LINQ - Entity framework code first - Grouped results to custom class
- Does Linq in Entity Framework code first use SQL or does it get the whole table first?
- Entity Framework 4 and Linq to Entities specifications: How to code it?
- Getting InvalidCastException when trying to implement sorting in Entity Framework Code First using Linq
- c# WPF bind combobox to TPH in Entity Framework code first using LINQ
- Proper Linq Query for objects with many to many relation ship generated with code first entity framework
- Code First Entity Framework Linq Statement Returning Missing Records
- Entity Framework dynamic linq where from generic source with dynamic where clause
- Entity Framework Code Most First Efficient Linq Query
- Entity Framework Code First - The entity or complex type cannot be constructed in a LINQ to Entities query
- Entity framework linq query Include() multiple children entities
- How to avoid Query Plan re-compilation when using IEnumerable.Contains in Entity Framework LINQ queries?
- How can I do a Union all in Entity Framework LINQ To Entities?
- What are the Java equivalents to Linq and Entity Framework
- Should the order of LINQ query clauses affect Entity Framework performance?
- Distinct on Multiple Columns Entity Framework LINQ
- How to wrap Entity Framework to intercept the LINQ expression just before execution?
- Entity Framework Linq query: .Where chain vs &&
- The LINQ expression node type 'Invoke' is not supported in LINQ to Entities in entity framework
- Which LINQ statements force Entity Framework to return from the DB?
- Entity Framework with LINQ aggregate to concatenate string?
- Entity Framework 6 Code First Custom Functions
- Filtering include items in LINQ and Entity Framework
- Is an outer join possible with Linq to Entity Framework
- How to avoid memory overflow when querying large datasets with Entity Framework and LINQ
- Entity Framework + LINQ + "Contains" == Super Slow?
- Join in LINQ and Entity Framework
- Programmatically chain OrderBy/ThenBy using LINQ / Entity Framework
More Query from same tag
- Select particular record if match is found otherwise First record in IGrouping<T>
- Where Contains from two function calls
- .NET MongoDb - How can I insert an element to list in n-nested structure
- Convert aggregate SQL query to LINQ
- LINQ double Join takes too long to execute
- Why Fetch should be the last clause in Linq Nhibernate query
- Linq To SQL: Most Efficient Way of Looping through List of ID's
- Searching By ID - ASP.NET MVC
- KeyValuePair from running Raw SQL query on Entity Framework
- LINQ How to Remove Empty Elements at End of Collection
- RavenDB query on property of Id struct
- How to create a 'global' variable to return linq result?
- Selecting User from a table with LINQ statements/expression
- Cleanest syntax to delete a record in linqtosql
- "Unzip" IEnumerable dynamically in C# or best alternative
- Complex SQL to LINQ conversion with subquery
- LINQ to SQL Classes, How to change column format? (DataGrid)
- Get Func<T1, T2> from PropertyInfo
- Convert LINQ query to List
- How to Read a text file add line to List<> in Linq
- How to get first index of Binary Search's results?
- C# linq - Change the selected field at runtime
- How to get children data from json via linq
- LINQ to SQL omit field from results while still including it in the where clause
- linq - fill out sparse table for plot
- LINQ to SQL how optimise query?
- Linq query a List of objects containing a list of object
- LINQ conversion issue
- Retrieving a field that does not belong to the model
- Entity Framework One to Many Relationship Model - How to select column from the child table