www.1862.net > linq to sql orDEr By

linq to sql orDEr By

db.S.Where(q=>q.TypeID==1).OrderByDesending(q=>q.ID).Take(1);

先对a,b进行group by 分组,然后针对分组select的时候new 一个匿名对象,包含 absum 和的值出来,针对和进行order by 不就行了

var c = db.Table.OrderByDescending(q=>q.ID).Take(10);

老简单了, 先orderby p.id.HasValue 然后再 descending, p.id

static void Main(string[] args) { string[] all = new string[] { "a2", "b6", "4", "5", "3", "cc1.1" }; var v = all.Select(a => new { a, ints = new string(a.Where(c => char.IsDigit(c) || c == '.').ToArray()) }).Select(b => new { ...

text类型就别做DISTINCT了,效率会让你吐血。 实在想做的话,尝试newslist = newslist.OrderBy(x=>x.nID).ToList().Distinct(); 将数据加载入内存,用CLR来做DISTINCT

网站地图

All rights reserved Powered by www.1862.net

copyright ©right 2010-2021。
www.1862.net内容来自网络,如有侵犯请联系客服。zhit325@qq.com