Using a CASE statement in HQL select

后端 未结 7 596
再見小時候
再見小時候 2020-12-10 01:51

Is there any way to do the following in HQL:

SELECT 
    case when flag = true then SUM(col1) else SUM(col2)
FROM 
    myTable
7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-10 02:14

    See Hibernate-Forum: https://forum.hibernate.org/viewtopic.php?t=942197

    Answer from Team (Gavin): case is supported in the where clause, but not in the select clause in HB3.

    And seen in JIRA with State "Unresolved".

提交回复
热议问题