1

私はこの状況を持っています:

select max(id) from OTX group by AccNo

LINQ クエリに変換したいのですが、うまくいきません。これを試してみましたが、Message = "The member 'XX' has no supported translation to SQL." と表示されます。

var result = from otx in datacTx.OTX
             group otxCf by otxCf.AccNo
             into Client
             select Client.Max().ID;
4

2 に答える 2

2

試す

var result = from otx in datacTx.OTX
         group otxCf by otxCf.AccNo
         into Client
         select Client.Max(r=>r.id);

または、同じものが必要な場合

select AccNo, max(id) from OTX group by AccNo

それから試してください

var result = from otx in datacTx.OTX
         group otxCf by otxCf.AccNo
         into Client
         select new { AccNo = Client.Key , MaxValue= Client.Max(r=>r.id) } ;
于 2013-07-11T20:18:49.580 に答える
0
var result = from otx in datacTx.OTX
             group otxCf by otxCf.AccNo
             into Client
             select new { MaxId = Client.Max(s => s.ID)};
于 2013-07-11T20:19:44.327 に答える