17,377
社区成员
发帖
与我相关
我的任务
分享
select distinct dd.d1,dd.d2,max(t.count) over()
from demo t
inner join ( select d.id d1,sum(d.count) d2
from demo d group by d.id) dd on dd.d1=t.id
order by dd.d1
select zz.*,
max(count) over() as "max_count"
from (
select tt.id,
count(*) as "count"
from tablename tt
group by tt.id
)zz;