Is there any option if categori.categori_type != 'comment' return comment null and SUM poor,fair,good,vgood,vgood,excellent,yes,no column otherwise return this columns 0. I have more than 1 comment but it s return only 1 comment.
SELECT
categori.s_categori_id,categori.categori_name_en,categori.categori_name_ar,
categori.categori_type,question.survey_id,question.question_en,
question.question_ar,
IF(categori.categori_type != 'comment',SUM(result.poor),0) AS poor,
IF(categori.categori_type != 'comment',SUM(result.fair),0) AS fair,
IF(categori.categori_type != 'comment',SUM(result.good),0) AS good,
IF(categori.categori_type != 'comment',SUM(result.vgood),0) AS vgood,
IF(categori.categori_type != 'comment',SUM(result.excellent),0) AS
excellent,
IF(categori.categori_type != 'comment',SUM(result.yes),0) AS yes,
IF(categori.categori_type != 'comment',SUM(result.no),0) As no,
result.comment
FROM survey_categori AS categori
INNER JOIN survey_questions AS question
ON categori.s_categori_id = question.s_categori_id
INNER JOIN survey_result AS result
ON result.s_question_id = question.survey_id
WHERE categori.survey_type = 'class'
GROUP BY question.survey_id