0
我想獲得特定列的總和,所以我在linq中使用了這個組,但好像我必須在連接中得到錯誤。這些字段的數據類型是相同的。這不是原來的查詢,而是爲Stack Overflow發佈的內容組成的。連接子句中的其中一個表達式的類型不正確。在「GroupJoin」調用中,類型推斷失敗
from T1 in TXPYTRANs
join T11 in ((from p in TXPYTRANs // geting error right here
group p by new { p.TRANTYPE, p.BILLYR, p.BILLNO } into g
select new
{
TRANAMT = g.Sum(b => b.TRANAMT),
TRANPENALTY = g.Sum(b => b.TRANPENALTY),
TRANINTEREST = g.Sum(b => b.TRANINTEREST),
TRANTYPE = g.Select(s => s.TRANTYPE),
BillYear = g.Select(s => s.BILLYR),
BillNumber = g.Select(s => s.BILLNO)
}).Take(100))
on new { BYr = T1.BILLYR, BNo = T1.BILLNO }
equals new { BYr = T11.BillYear, BNo = T11.BillNumber } into T12
from T13 in T12
select new
{
TranType = T13.TRANTYPE,
TranAmt = T13.TRANAMT,
TranPenalty = T13.TRANPENALTY,
TranInterest = T13.TRANINTEREST,
BillYr = T13.BillYr,
BillNo = T13.BillNo
}