【发布时间】:2013-02-02 13:21:03
【问题描述】:
我有一个 sql 查询
select count(salary)
from USER_DETAILS
where salary>0 and salary<1000 union all
select count(salary)
from USER_DETAILS
where salary>1000 and salary<10000 union all
select count(salary)
from USER_DETAILS
where salary>10000 and salary<100000
是否有任何其他合乎逻辑或更稳健的方式来执行相同的查询(最好在 hql 中)。
提前致谢
【问题讨论】:
-
可能是
case声明会有所帮助 -
到目前为止还没有使用过 case 不知道它是否会起作用 您可以使用“case”或使用“case”的任何此类链接提供该查询。顺便说一句
-
感谢@asifsid88 我得到了解决方案
标签: sql oracle hibernate select