取資料時需要取某欄位相同值之後再取得最新的一筆
用FKCustomerRosterGenericDetail當Key再把Entity放到對應的Key中(另外再OrderBy)
var gEntitys = (from b in bizEntitys
group b by b.FKCustomerRosterGenericDetail into o
select new {
FKCustomerRosterGenericDetail = o.Key,
o = o.OrderBy(p => p.CreateDate).FirstOrDefault()
}
);
用Key跑迴圈就能對分群好的資料做處理
foreach (var e in gEntitys)
callQueueVoList.Add(this.CreateVOFromBizEntity(e.o));
參考網站:http://www.cnblogs.com/lyj/archive/2008/01/25/1052713.html
沒有留言:
張貼留言