如何在 linq VB.NET 中编写此查询?
select top 15 count(1), A.Latitude, A.Longitude
from Bairro A
inner join Empresa B on B.BairroID = A.BairroID
where A.CidadeID = 4810
group by A.Latitude, A.Longitude
order by COUNT(1) desc
我达到了这个代码:
Dim TopBairros = (From A In Bairros _
Join B In New BO.Empresa().Select On B.BairroID Equals A.BairroID Group A By A.Latitude, A.Longitude Into g = Group _
Select g Distinct _
Order By g.Count Descending).Take(15)
每行都有一个数组集合,其中包含重复的具有计数的相同对象。例子:
第 0 行:包含 874 个相同对象的数组 第 1 行:包含 710 个相同对象的数组
等等...如何才能每行只返回一个对象?