我想检索 transnett 和 obnett 的前一行值,以根据 StackHistoryID 更新当前行,那么上述查询是否有效?
var val = (from tn in db.tablename.ToList()
where tn.ID.ToString() != currentID.ToString()
orderby tn.TransactionDate descending
group tn by tn.StackHistoryID into trans
select new {
transnett=trans.Select(t=>t.TransNett),
obnett=trans.Select(t=>t.OBNett)
}).FirstOrDefault();