您可以帮助我将此sql语句转换为c#linq2sql吗?
select [series] from table group by [series] order by max([date]) desc
这是我到目前为止 - 列表的顺序不正确..
var x = from c in db.Table
orderby c.Date descending
group c by c.Series into d
select d.Key;
答案 0 :(得分:0)
您的LINQ orderby
子句与SQL的子句不同。在这里,这应该解决它:
var query = from c in db.Table
group c by c.Series into d
orderby d.Max(item => item.Date) descending
select d.Key;