8,497
社区成员
发帖
与我相关
我的任务
分享
select o.FootID,o.Speed,o.Ullage,o.PassMatchID,o.LoftID,row_number() OVER (PARTITION BY o.PassMatchID ORDER BY o.speed desc) as lev,(select count(footid) from Table1 one where one.PassMatchID=o.PassMatchID ) as allnum into #temp1 from Table1 o order by PassMatchID desc
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()
};