我正在尝试将我的 sql commang 写入 Linq:
SQL:
select avg(sub.evaluation) from submit_task sub where student_id='" + idStudent + "' and state='close';
林克:
double avg = (ado.submit_task.Where(r => (r.id == idStudent && r.state == "close")).Average(r => r.evaluation));
avgStudent = avg.ToString();
但这不起作用,当我删除&& r.state == "close"
语句时,我得到了结果,但它不正确。
谢谢你。