【问题标题】:How to convert this statement from MySQL to HQL?如何将此语句从 MySQL 转换为 HQL?
【发布时间】:2014-03-12 15:26:38
【问题描述】:

这是 SQL 语句:

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;

【问题讨论】:

    标签: java mysql sql hibernate hql


    【解决方案1】:

    这是一个 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;
    

    【讨论】:

    • 我已经解决了谢谢select opc.contenido, count(r.idOpcPregunta) from Respuestasimple as r right join r.idOpcPregunta as opc where opc.idPregunta ='6' group by opc.contenido
    【解决方案2】:

    这是句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
    

    【讨论】:

      猜你喜欢
      • 2020-08-31
      • 2023-03-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-05
      相关资源
      最近更新 更多