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.

LINQPad Website

hope this helps


from t in Temp_Nurse_Fill_RequestNumbers 
group by t.ShiftName,
into g 
select new 
   Date =,
   Score = (from tt in g select tt.Score).max
   IsPreferred = 1


Hmm, how about something like this (this is C#, I presume it is trivial to convert)

    .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


Just for convenience

    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


Sorry didn't noticed that the final projection is not anonymous but named type.

Related Query

More Query from same tag