I have a query:
SELECT p.id,
resultado,
(count(resultado)*100)/(SELECT COUNT(*) FROM IAssesment_Evaluaciones WHERE area='TlP/LOP2.1') count
FROM IAssesment_Evaluaciones e
INNER JOIN IAssesment_Resultados r
ON e.id=r.id_evaluacion
LEFT OUTER JOIN IAssesment_Tipo_Resultados t
ON t.id=r.resultado
INNER JOIN IAssesment_Preguntas p
ON r.id_pregunta=p.id
WHERE area='TlP/LOP2.1'
GROUP BY resultado,p.id ORDER BY p.id,resultado
This shows the data well:
id resultado count
1 2 100
2 2 100
3 2 50
3 3 50
4 1 33
4 2 66
5 1 50
5 2 33
5 3 16
My problem is that the IAssesment_Tipo_Resultados
table has 3 types of results (1,2,3). What I need is for my query to return the 3 types of values even though it has no value. As an example of the results of the previous query, this is the result I need:
id resultado COUNT
1 2 100
1 1 0
1 3 0
Thanks for your help