原创

MySQL-数据修复-2021年的考试没有生成-insert select-时间-时间戳互转-concat-5位随机数


exam_associated_user 有数据
exams_member 无数据
exam_marking 无数据


-- member表 -5位随机数
INSERT into exams_member (exam_id,user_id,login_id,ticket_no,create_time,enterprise_id)
select exam_id,user_id,0,concat(34, FROM_UNIXTIME(UNIX_TIMESTAMP(now()),'%Y%m%d%H%i'), CEILING(RAND()*90000+10000)),UNIX_TIMESTAMP(now()),container_id from exam_associated_user where user_id not in (select login_id from exams_member where enterprise_id = 'jiangsudipukejigufen' and exam_id = 2925) and container_id = 'jiangsudipukejigufen' and exam_id = 2925;

-- markging 
INSERT into exam_marking (enterprise_id,work_id,user_id,status,is_pass,is_take,create_time,update_time,answer_time,is_miss) 
select container_id,exam_id,user_id,1,0,1,UNIX_TIMESTAMP(now()),UNIX_TIMESTAMP(now()),1629216000,1 from exam_associated_user where user_id not in (select user_id from exam_marking where enterprise_id = 'jiangsudipukejigufen' and work_id = 2925 and is_delete = 0) and container_id = 'jiangsudipukejigufen' and exam_id = 2925;
正文到此结束
本文目录