Linq / Group and Count ?
Posted: Thu 15 Feb 2018 02:47
How would the following translate into the EntityDac Linq syntax ?
I'm guessing something like:
How do you do the Count in the Select ?
Code: Select all
select Username, count(Username) as cnt
from MacAddresses
group by Username
Code: Select all
var
Query : ILinqQueryable;
Mac : IMacaddressExpression;
begin
Mac := MacDataContext1.Macaddress;
Query := From(Mac).GroupBy(Mac.Username).Select([Mac.Username]);
EntityDataSet1.SourceCollection := MacDataContext1.GetEntities(Query);