oracle实现按天查询最大值、最小值、平均值

    技术2025-10-08  8

    oracle实现按天查询最大值、最小值、平均值

    主要用到的函数

    MAX()最大值MIN()最小值SVG()平均值round()截取小数点后几位to_number()将字符串类型转数字类型 SELECT ps.device_intenet_num,to_char(ps.uploadtime, 'yyyy-mm-dd') as uploadtime,MAX(to_number(ps.firstcurrentvalue)),MIN(to_number(ps.firstcurrentvalue)),MAX(to_number(ps.firsttemperaturevalue)), round(avg(ps.firstcurrentvalue),2) FROM pw_smdevicedata ps where device_intenet_num='177-1' GROUP BY to_char(ps.uploadtime, 'yyyy-mm-dd'),ps.device_intenet_num ORDER BY uploadtime;
    Processed: 0.010, SQL: 9