0
에 MAX에 의해 그룹에 가입 변환
나는 SQL 쿼리를 다음 만든하지만 난 StatusAndTrackingNotes 테이블 내 LINQ에 참여 구현하는 방법을 찾을 수 없습니다 이니 좋은 말 좀 도와SQL LINQ에
SELECT *
FROM [Application] APP
join User USR on APP.ApplicationId = USR.UserApplicationId
join
(Select MAX(TrackingDate) as MaxDateTD,TrackingApplicationId
From StatusAndTrackingNotes
where TrackingLoanType = 1 and ((TrackingStatusCode <= 52 and TrackingStatusCode >= 50) or TrackingStatusCode = 62)
group by TrackingApplicationId) MTND on APP.ApplicationId = MTND.TrackingApplicationId
join Details DTL on APP.ApplicationId = DTL.ApplicationId
join ApplicationFees AF on APP.ApplicationId = AF.ApplicationId
where APP.LatestStatus = 'F' and DTL.Type = 1 and DTL.FundingDate >= '2011-06-01' and DTL.FundingDate <= '2013-06-30'
and AF.FirstRefPaidDate is not null
을 syntax.First 내가 조인과 간단한 쿼리를 사용하여 사용하고
([Linq Query]).GroupBy(i => i.TrackingApplicationId).Select(g => g.OrderByDescending(c => c.TrackingDate).FirstOrDefault());
하지만 어떤 결과를 반환하지 않습니다. 친절하게 도와주세요. 미리 감사드립니다.
"grouping TrackingApplicationId"는이 경우 작동합니다 ..? –
@ samsam123 네, 그럴 수 있습니다. 그것은 비록 다른 SQL - 코드에서 발생합니다 확실하지 않아요. 내 업데이트를 확인하십시오. –