日期:2014-05-20  浏览次数:20757 次

问题比较多,所以每次给分不是很高,但是经常有问题
var query = (from a in adviceNoteEarnestMoneyTableEntities.View_AdviceNoteRightTable
  join b in adviceNoteEarnestMoneyTableEntities.AdviceNoteLinkTable.Where(x => x.PayType == 42) on a.AdviceID equals b.AdviceID
  join c in adviceNoteEarnestMoneyTableEntities.OverWeightRec on b.PayReturnID equals c.ID
  join d in adviceNoteEarnestMoneyTableEntities.ContractSubPutPayment.Where(y => y.PayType == 2) on c.ID equals d.RPID into t
  from d in t.DefaultIfEmpty()
  group new { a, b, c, d } by new { a.AdviceID, a.AdviceState,a.AdviceType, c.ID, c.OverWeightDate, c.OverWeightCount } into g
  select new
  {
  AdviceID = g.Key.AdviceID,
  AdviceState = g.Key.AdviceState,
  AdviceType=g.Key.AdviceType,
  ID = g.Key.ID,
  OverWeightDate = g.Key.OverWeightDate,
  OverWeightCount = g.Key.OverWeightCount,
  SumMonery = g.Sum(z => z.d.PayMoney)
  }).OrderBy(s => s.ID);
我下面还有统计OverWeightCount = g.Key.OverWeightCount,
  SumMonery = g.Sum(z => z.d.PayMoney)这个两个字段的和sum(OverWeightCount)和sum(SumMonery)什么办法都行,能求出来就行 ,当然最好效率高点,我要把统计出来的值赋值给2个 lable

------解决方案--------------------
浩然给我分吧,我不会你的问题。