2 result ตารางผลการทำข้อสอบ
id
name
session_id
score
Code (SQL)
select rule.*
, count(result.id) all_cus
, sum( result.score>=rule.pass_score) pass_num
, sum( result.score<rule.pass_score) fail_num
from rule, result
where rule.session_id = result.session_id
group by rule.session_id