小编Luc*_*uca的帖子

hibernate内部select in from子句

我想知道是否可以在from子句中指定一个select子句

select count(*) as Y, this_.NAME as A, sel2.C
from TABLE1 this_, 
    (select count(*) as C from 
        (select this_.NAME, this_.SEX 
        from TABLE1 this_ group by this_.NAME, this_.SEX) sel1
    ) sel2
group by this_.NAME, sel2.C;
Run Code Online (Sandbox Code Playgroud)

我需要这样的查询,以便将计数作为外部查询中的额外列.我无法找到如何在from中指定select语句,既不使用hql也不使用条件.

谢谢.

卢卡

select hibernate hql criteria

13
推荐指数
1
解决办法
2万
查看次数

标签 统计

criteria ×1

hibernate ×1

hql ×1

select ×1