This is the sentence HQL
select opc.contenido, count(r.idOpcPregunta) from Respuestasimples as r
right join r.idOpcPregunta as opc where opc.idPregunta ='6'
group by opc.contenido
Question
This is the SQL statement:
SELECT opc.contenido, COUNT(r.idOpcPregunta)
from Opcionesrespuestas as opc LEFT JOIN Respuestasimples as r ON r.idOpcPregunta = opc.idOpcPregunta
where opc.idPregunta ='6'
GROUP BY opc.idOpcPregunta;
Solution 2
This is the sentence HQL
select opc.contenido, count(r.idOpcPregunta) from Respuestasimples as r
right join r.idOpcPregunta as opc where opc.idPregunta ='6'
group by opc.contenido
OTHER TIPS
This is a HQL
select opc.contenido, count(r.idOpcPregunta)
from Opcionesrespuestas as opc
left join opc.OpcPregunta as r
where opc.idPregunta ='6'
group by opc.contenido;