select * from customer_report left join (SELECT *
FROM
exam
JOIN question ON exam.id_exam = question.exam_id_exam WHERE dept_question =0
GROUP BY
question.exam_id_exam)
select * from customer_report a left join
(SELECT col1,col2,col3
FROM
exam
JOIN question ON exam.id_exam = question.exam_id_exam WHERE dept_question =0
GROUP BY
question.exam_id_exam) as b
ON a.col1 = b.col1