开发者

multiple column selection with aggregate function in LINQ dictionary

开发者 https://www.devze.com 2023-01-01 23:08 出处:网络
I was unable to cope with converting 开发者_JS百科this Sql Query to Linq Expression SELECT IdVehicle,

I was unable to cope with converting 开发者_JS百科this Sql Query to Linq Expression

SELECT IdVehicle, AVG(Kilometers) FROM [Fuel] GROUP BY IdVehicle, CONVERT(NVARCHAR, Fuel.Time, 102)

Rows are inserted into this table when someone fills fuel into vehicle. Kilometers are read from tachograph. It's possible to fill fuel twice a day so I need average value. Ideally, LINQ result would be Dictionary.

I would really appreciate any suggestion.


For cases like these you might wanna try LinqPad (www.linqpad.net). This great tool lets you test and analyze both SQL statements and Linq expressions.

0

精彩评论

暂无评论...
验证码 换一张
取 消