在这里,我得到了计数三行的值,但我需要那些计数行...
但无法编写查询...请帮助我......
if(Q1 < 20, '1', if(Q1 == 20, '2', '3'))
答案 0 :(得分:0)
你的意思是:
SELECT e.exam_name, e.course_id, COUNT(*)
FROM sg_examinations e
JOIN sg_exam_types t
ON t.id = e.exam_name
LEFT
JOIN sg_courses c
ON c.id = e.course_id
WHERE e.branch_id = 1
AND e.academic_year = 2
GROUP
BY e.exam_name, e.course_id