count distinct with group by

Posts   
 
    
akurland
User
Posts: 1
Joined: 10-May-2017
# Posted on: 10-May-2017 18:56:17   

Hello, this question has already been asked in a thread below, so looking for an updated answer.

http://llblgen.com/TinyForum/Messages.aspx?ThreadID=23095&HighLight=1

Is there any new functionality in the latest LLBLGEN LINQ version, where you can achieve group by with distinct count WITHOUT repeating the query?

For example:

Select Country, Count(Distinct City) From Customers Group by Country

var q = from c in metadata.Customer group c by new { c.Country} into g select new { g.Key.Country, CityCount.Distinct().Count() }

Thanks, Albert

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 11-May-2017 08:46:26   

Hi Albert,

According to the documentation you could use CountColumn(field [, bool applyDistinct])

David Elizondo | LLBLGen Support Team