How to use Distinct with Group By ??

Posts   
 
    
MarcoP avatar
MarcoP
User
Posts: 270
Joined: 29-Sep-2004
# Posted on: 27-Aug-2010 03:24:05   

Anyone know how to use Distinct() with Group By? I tried the following with no luck..

            var q = from i in MetaData.ProcessRoundIssueInstance
                    group i by i.GroupID into g
                    select new
                    {
                        Group = g.Key,
                        UniqueUsers = g.Select(x => x.UserID).Distinct().Count()
                    };

Thanks!

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 27-Aug-2010 07:18:26   

What is the SQL you are trying to reproduce?

David Elizondo | LLBLGen Support Team