-- 1.3.15

USE `stmms_ft`;

ALTER TABLE m_reject_history ADD INDEX index2(`library_id`);
ALTER TABLE eb_inspect_history MODIFY column inspector_id INT (11) NOT NULL COMMENT '复核人ID';
ALTER TABLE eb_inspect_history MODIFY column  student_id INT (11) NOT NULL COMMENT '考生ID';
ALTER TABLE eb_selective_group MODIFY column score_policy	varchar(64) NOT NULL COMMENT '合分方式';
ALTER TABLE eb_selective_student ADD COLUMN `not_selective`	tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否未选做';
-- 更新选做题未选做数据
update eb_selective_student set not_selective=1 where student_id 
in(
	select tem.student_id from 
	(
		select 
		e.student_id,
		sg.selective_index,
		sum(case when e.group_score != -1 then 1 else 0 end) cc
		from eb_subjective_score e 
		left join eb_mark_group mg on e.exam_id=mg.exam_id and e.subject_code=mg.subject_code and e.group_number=mg.number
		left join eb_selective_group sg on sg.exam_id=e.exam_id and sg.subject_code=e.subject_code and sg.main_number=e.main_number 
		where mg.is_selective=1
		GROUP BY e.student_id,sg.selective_index
	)tem where tem.cc=0
);