表结构是这样的
    时间   设备id   输出值
   2013040100  123   100
   2013040101  123   200这个表会存储一个月中 每天24小时的 输出值
 存储情况如上
 我现在想求出  这个表 每一天的 最大输出值
数据库用的是oracle,这个表的构成是通过一个sql查询得到的

解决方案 »

  1.   

    select * from
    (
    select rank() over (partition by 时间 order by 输出值 desc) as rk, 时间, 设备id, 输出值 from table
    )
    where rk = 1;
      

  2.   

    搞错了,partition by 的时间要截取为天。不过思路就是这样了
      

  3.   

    with temp_tab as(
    select substr(时间) tt,输出值 from tab_name
    )
    select tt,max(输出值) from temp_tab group by tt;
     
      

  4.   

    select max(value),substr(时间,1,8) from tablename
    group by substr(时间,1,8)