Using a CASE statement in HQL select

后端 未结 7 600
再見小時候
再見小時候 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:35

    Apparently the ability to do this was added in 3.0.4, with the limitation that you cannot use sub-selects in the else clause.

提交回复
热议问题