$@"insert into Exam_ExamStudent(ESId,ClassNo,AcademicYearNo,Semester,StuNo,StuName,ESType,ESEnabled,Grade)
$@"insert into Exam_ExamStudent(ESId,ClassNo,AcademicYearNo,Semester,StuNo,StuName,ESType,ESEnabled,Grade)
select newid(), a.classno, '{AcademicYearNo}', '{Semester}', a.stuno, a.stuname, '{ESType}', 1,a.Grade from StuInfoBasic a where CheckMark = '1' and stuno not in (select stuno from Exam_ExamStudent where AcademicYearNo = '{AcademicYearNo}' and Semester = '{Semester}' and ESType = '1' union
select StuNo from StuInfoBasicChange where StuChangeType in ('04','05','06') and CheckStatus='1')");
where 1=1 and a.LessonSortNo='1' and ((a.Score>=0 and a.Score<60) or a.Score=(-5) or a.Score=(-10)) ");
where 1=1 and a.LessonSortNo='1' and ((a.Score>=0 and a.Score<60) or a.Score=(-5) or a.Score=(-10)) ");
strSql.Append(" and a.AcademicYearNo ='" + AcademicYearNo + "' and a.Semester ='" + Semester + "' ");
strSql.Append(" and a.AcademicYearNo ='" + AcademicYearNo + "' and a.Semester ='" + Semester + "' ");
strSql.Append(" and (b.ChangeStatus<>'1' or len(b.ChangeStatus)=0 or b.ChangeStatus is null) ");
strSql.Append(" and (b.ChangeStatus<>'1' or len(b.ChangeStatus)=0 or b.ChangeStatus is null) ");
strSql.Append($@" and a.stuno not in (select stuno from Exam_ExamStudent where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' and ESType='{ESType}' union
select StuNo from StuInfoBasicChange where StuChangeType in ('04','05','06') and CheckStatus='1' ) ");
strSql.Append($@" and a.stuno not in
(select stuno from Exam_ExamStudent where AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' and ESType='{ESType}'
) ");
strSql.Append(" group by a.stuno,a.stuname,a.classno,b.Grade");
strSql.Append(" group by a.stuno,a.stuname,a.classno,b.Grade");