[size=xx-small][/size]数据库中:表 A 字段 aa,bb,cc
写如下语句:
select count(aa) as a
from A
where bb like 'a' and a=1
group by cc
报错:前面命名的新字段a在后面用不了 a=1
改成这样:
select * from
(
select count(aa) as a
from A
where bb like 'a'
group by cc
)t where t.a=1
这种情况就可以了!但写成HQL语句就不行了
问:这种情况该如何改写成相应的HQL语句? :)