【发布时间】:2010-12-31 06:43:04
【问题描述】:
如何在 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 个相同对象的数组
等等...如何每行只返回一个对象?
【问题讨论】:
标签: sql vb.net linq linq-to-sql linq-group