select st.Number,st.Name,st.ClassCode,
isnull(com_stu.cd,0) as cd,isnull(com_stu.zt,0) as zt,
isnull(com_stu.kk,0) as kk,isnull(com_stu.zywwc,0)as zywwc
from t_student st left join (
select Studentid,
count(case when Type = '01' then 1 end) as cd,
count(case when Type = '02' then 1 end) as zt,
count(case when Type = '03' then 1 end) as kk,
count(case when Type = '04' then 1 end) as zywwc
from t_comments_stu
where 1=1
and CourseID='" + strCourse + "'
and CONVERT(varchar(12) , ClassTime, 112 )='" + Common.GetDateTime(strClassTime, "yyyyMMdd") + "'
group by StudentID
) com_stu on st.ID = com_stu.StudentID
where st.ClassCode='" + strClass + "'
本文介绍了一种使用SQL从学生评价数据中汇总特定课程评价结果的方法。通过左连接和CASE语句,实现了对学生不同类型的评价计数(如表扬、建议等),并按班级筛选展示每个学生的评价统计数据。
914

被折叠的 条评论
为什么被折叠?



