sql聚集函数的嵌套

2025-01-20 21:59:11
推荐回答(5个)
回答1:

我也试了下,确实不能直接用,只能用临时表完成了SELECT count(*) as c into #t
FROM GameUserInfo group by RegisterIP
Select max(c) From #t这个是用我的数据库实验的.

回答2:

select max(t1.times)
from
(
select count(*) as times from tableA group by conditionA
) as t1

把结果集起个别名就好了

回答3:

你用的是内查询,可以这样做:
select top 1 from 表 where exists (select count(*) as times from tableA group by conditionA
oder by times desc)

回答4:

在末尾加个表别名即可。select max(times)
from
(
select count(*) as times from tableA group by conditionA
) tt

回答5:

看来还是要依靠自己,其实很简单的修改几句代码就可以搞定,已经成功实现,结贴吧