Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个有 5 列的简单表格
id id_user col1 col2 col3
如何让 Linq 查询选择一个 id_user 并对所有 col1、col2、col3 整数求和以求出这 3 列的平均值?
谢谢
假设你已经有了你的桌子,应该这样做:
from row in table let avgTotal = (new [] {row.col1, row.col2, row.col3}).Average() select new {row.user_id, avgTotal}