(student_id, subject_code_id, dt_update, short_name, overall_accuracy, overall_coverage, last_three_months_coverage, last_three_months_accuracy) SELECT * FROM ( SELECT 85, e.subject_code_id, (NOW() - INTERVAL ROUND((RAND() * (90-0))+0) DAY) as dt_update, ec.short_name, ROUND(AVG((RAND() * (100-0))+0)) as overall_accuracy, ROUND(AVG((RAND() * (100-0))+0)) as overall_coverage, ROUND(AVG((RAND() * (100-0))+0)) as last_three_months_coverage, ROUND(AVG((RAND() * (100-0))+0)) as last_three_months_accuracy FROM edu_student_subject e LEFT JOIN edu_subject_code ec ON ec.subject_code_id = e.subject_code_id WHERE e.student_id=85 GROUP BY e.subject_code_id) as tbl1 ON DUPLICATE KEY UPDATE dt_update = tbl1.dt_update, short_name = tbl1.short_name, overall_accuracy = tbl1.overall_accuracy, overall_coverage = tbl1.overall_coverage, last_three_months_coverage = tbl1.last_three_months_coverage, last_three_months_accuracy = tbl1.last_three_months_accuracy;
No comments:
Post a Comment