大家好,
想问一下,在hibernate中,使用count(*)+子查询报错了,难道不支持吗?
如果把count(*)換成是具体的字段确是可以的,
我用的是hibernate 2.XXX
hibernate的hql不支持*号,换成sql就可以了
[quote]使用count(*)+子查询报错[/quote]
能不能把你的语句贴下。
[quote]select count(*) from (select distinct a.XXX,a.xxx from customers [/quote]
[color=indigo]这个语句的问题啊 和hibernate没关系啊 。。
count(*) from 子查询 语法通不过的 count和子查询这么连用 不能用* 得指定某个字段 eg: select count(y.x) from (select distinct a.XXX,a.xxx from customers a) y[/color]
但是你得命名啊
: select count(*) from (select distinct a.XXX,a.xxx from customers a) y
后面这个y没有 就不行
哦哦 那是我的问题了 哎~ 我SQL基础太不扎实了 可能是我用mysql试验的原因 我用mysql实验没通过 自己电脑上没装oracle