0
어떻게 linq VB.NET에서이 쿼리를 작성합니까?linq to group by
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)
각 행 repeatly 카운트 넘버와 같은 오브젝트를 포함하는 어레이 컬렉션을 가지고
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
는이 코드에 달했다. 예 :
행 0 : 874 같은 객체 1 행의 배열 : (710)와 동일한 개체
등의 배열 ... 내가 행 당 하나의 개체를 반환하기 위해 어떻게해야합니까?
...이 코드에 도달 : 희미한 TopBairros =을 (Bairros에서 A로부터 것은 _ ) (뉴 BO.Empresa에서 B에 가입하세요. 선택 B.BairroID Equals A.BairroID Group A A.Latitude, A.Longitude into g = Group _ g 선택 Distinct _ g.Count Descending) .Take (15) 각 행에 배열 컬렉션이 있습니다. 카운트 번호와 동일한 객체를 반복적으로 포함합니다. 예 : 행 0 : 874 동일한 객체 배열 행 1 : 동일한 객체 객체 배열 등 ... 행당 하나의 객체 만 반환하려면 어떻게해야합니까? – Fernando
@Fernando : 끝 부분에있는 투영법을 사용하여 그룹의 키와 개수를 선택합니다. –