【发布时间】:2019-01-06 19:50:48
【问题描述】:
我在 SQL Server 中有这个查询
select max(win_votos), win.cdt_id, cdt_nome
from tb_ganhadores_win as win
inner join tb_candidatos_cdt as cdt on cdt.cdt_id = win.cdt_id
group by win.cdt_id,cdt_nome
我需要创建一个列表“AspNetMvc”页面,比如
public ActionResult ListWinners(int? id){
LINQ QUERY HERE
return View('that list');
}
对不起我的英语
谁能帮帮我?
【问题讨论】:
-
您是否在使用实体框架并进行设置?
-
在我看来,这个问题对于 Stackoverflow 来说太宽泛了。尝试上线并遵循基本教程。然后,如果您有问题,请回来向我们展示您尝试过的代码。
-
我有一些事情我忘了说,在 sql 中的查询结果中,我有一些具有相同最大值的项目,例如名称 1 - 2.0,名称 2 - 2.0(你能理解我的意思吗?想说什么?)
-
这就是我能做的:db.Ganhadores .Join(db.Candidatos, ganhadores => ganhadores.cdt_id, candidato => candidato.cdt_id, (ganhadores, candidato) => new { ganhadores , 候选人 }) .Where(g => g.ganhadores.vot_id == id) .Max(g => g.ganhadores.win_votos);但有了这个我不能放 '.tolist()'
标签: asp.net-mvc linq asp.net-mvc-5