score:0
You can use a tool called LINQPad.
Tired of querying in antiquated SQL? Well, you don't have to! LINQPad lets you interactively query databases in a modern query language: LINQ. Kiss goodbye to SQL Management Studio! ... LINQPad is also a great way to learn LINQ: it comes loaded with 500 examples from the book, C# 4.0 in a Nutshell. There's no better way to experience the coolness of LINQ and functional programming.
hope this helps
score:1
from t in Temp_Nurse_Fill_RequestNumbers
group by t.ShiftName, t.date
into g
select new
{
Date = g.date,
Score = (from tt in g select tt.Score).max
IsPreferred = 1
};
score:1
Hmm, how about something like this (this is C#, I presume it is trivial to convert)
temps
.GroupBy(x => new {x.ShiftName, x.Date})
.Select(g => new TempNurseProjection
{
Date = g.Key.Date,
ShiftName = g.Key.ShiftName,
MaxScore = g.Max(q => q.Score),
IsPreferred = true
});
score:1
Just for convenience
tems.
GroupBy(Function(x) New With { x.ShiftName, x.Date }).
Select(Function(g) New TempNurseProjection With {
.Date = g.Key.Date,
.ShiftName = g.Key.ShiftName,
.MaxScore = g.Max(Function(q) q.Score),
.IsPreferred = True
})
EDIT
Sorry didn't noticed that the final projection is not anonymous but named type.
Source: stackoverflow.com
Related Query
- How to convert this sql query into linq query. I am stuck at the group by and sum part
- How can I convert this SQL Query into LINQ (OVER (PARTITION BY Date))
- How to get SQL query into LINQ form in C# code
- How to convert this complex SQL Query with Subqueries into LINQ
- How to convert the SQL query into LINQ?
- How to convert sql inner join query into linq to sql query and convert into list
- How do I convert this SQL inner join query into LINQ syntax?
- How to convert Sql Datetime query into Linq
- C# How to convert SQL into a LINQ query
- How to convert the following SQL query to a Linq query in C#
- How to convert sql query into Linq to entities?
- How to convert this query string into LINQ to SQL query?
- how to convert a sql query into linq LEFT OUTER JOIN
- How to convert SQL Query into LinQ
- How can i convert a SQL query into LINQ using group and having?
- How to force LINQ to SQL to evaluate the whole query in the database?
- How to implement SkipWhile with Linq to Sql without first loading the whole list into memory?
- How can I write the following code more elegantly using LINQ query syntax?
- How to code the partial extensions that Linq to SQL autogenerates?
- Determine the source DataContext for a Linq to Sql query
- Convert SQL into Linq query
- How do I convert this SQL query to LINQ to SQL
- How to convert this SQL query to LINQ or Lambda expression?
- How is this Nested Set SQL query converted into a LINQ query?
- How do i convert this linq code to inline sql
- convert linq to object query to sql query (no linq to sql code or datacontext)
- How can I check the number of calls to the database in LINQ query when using .NET Core and Code First?
- how to convert from sql query to linq
- How to convert leftouterjoin query into LINQ
- How do I determine the source of unpredictable LINQ query results?
More Query from same tag
- Nothing returned after authentication?
- Linq to Nested Lists
- Apply Expression to object property in an Expression
- LINQ to entities - left join with condition
- how to fix the following issue in linq?
- How to select multiple columns from dataset into a string list with LinQ
- OrderBy with Dynamic Linq and one to many relationship in EF
- Combine similar character in string in C#
- Strange slowness while iterating over Linq result
- Linq Orderby random ThreadSafe for use in ASP.NET
- Conditionally Populate Class Field in LINQ To Entities
- cannot convert from 'System.Collections.Generic.List<NS.TagCollection>' to 'NS.TagCollection'
- LINQ Any an array to predicate an array whether it consists of the text of the first array
- Linq SQL datetime invocation error on app close
- How to use the System.LINQ.Dynamic assembly w/ IEnumerable(Of T)
- aggregate two objects in a list into one
- Join the result of a left join to another table
- SQL to LINQ - Multiple Group By Statements and a Join
- linq join on null
- LINQ to SQL not recognizing new associations?
- Use LINQ to find MAX or MIN of a field from all child records
- Does usage of contains on IEnumerable cast it to a List?
- Generic list comparison in C#
- Duplicates In DataTable, Getting Last By Specifying Two Properties
- operator '||' cannot be applied to operands of type 'string' and 'string' ( how i can fix this )
- Elegant solution to check if two dates are equal, in Linq (where the second date is NOT a parameter)
- Convert SQL statement to Linq Statement (3 table left joins + where)
- Get max datetime (db column) from a query subset using entity framework and linq?
- List number of items by date
- linq to xml - get childrem of those nodes with a certain attribute