当前位置:编程学习 > C#/ASP.NET >>

求大神帮忙,将一条SQL转换成linq,涉及row_number

--------------------编程问答-------------------- try:

var query=from t in (Table1.GroupBy(o=>o.PassMatchID)
 .Select(g=>g.OrderByDescending(x=>x.speed)
     .Select((o,i)=>new {o.FootID,o.Speed,o.Ullage,o.PassMatchID,o.LoftID,lev=i+1}
                     ))
          orderby t.PassMatchID descending
          select new {o.FootID,o.Speed,o.Ullage,o.PassMatchID,o.LoftID,lev,
allnum=Table1.Where(one=>one.PassMatchID==t.PassMatchID).Select(one=>one.footid).Count()
     };
 
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,