I have 6 survey tables, form_alumnos, dimension, questions, answer_type, answer.
and I have this query
SELECT p.id_pregunta, tr.tipo, COUNT(r.id_respuesta) as cantidad_respuestas
FROM encuesta e
LEFT JOIN form_alumnos f ON e.id_encuesta = f.id_encuesta_for
LEFT JOIN dimension d ON e.id_encuesta = d.id_encuesta_p
LEFT JOIN preguntas p ON d.id_dimension = p.id_dimension_p
LEFT JOIN tipo_respuesta tr on p.id_pregunta = tr.id_pregunta
LEFT JOIN respuesta r on tr.id_tipo = r.id_tipo
WHERE f.cod_curso_alumno = '354196' AND f.anio = '2016' AND f.semestre = 'Primer'
GROUP BY p.id_pregunta, tr.tipo
and that query throws me
the error of the query shows me all the data and I multiplies them by 6, I should show only the data of the student_code = '354196', anio = '2016', semester = 'First' and the query I want to make it should look like this:
I hope somebody can guide me, thank you in advance