你的datetime是date字段,如果出现一天内一个ci有多个时段cnt相等且最大,按表原始存储过程顺序取一个记录作为结果select datetime,timeHH,ci,cnt from (select datetime,timeHH,ci,cnt,row_number() over (partition by trunc(datetime),ci order by cnt desc) as FOrder from yourview) where FOrder=1当然也可以用not exists的写法或group by的写法,前者not exists 最大cnt多条时要取唯一记录最好还要提供一个主键字段,否则比较麻烦,后者group by最大c...
楼主你这个我看了20秒没理解到意思呢,能贴多贴几行数据看看吗?如果只是单纯的找最大值,就直接select datetime,timeHH,ci,max(cnt) from tb1 group bydatetime,timeHH,ci这里group by 里面的datetime, 和ITIMEHH,CI 需要减少一些范围,比...