Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select t.read_date, sum(s.sum_pow)/count(1) as sum from generate_series(current_date - '1 week'::interval,current_date,'10 minute') t(read_date) LEFT JOIN scan_movementscan s on s.read_date between t.read_date and t.read_date + '10 minute'::interval and s.device_id = %d group by t.read_date order by t.read_date;
- read_date | sum
- ---------------------+---------------------
- 2019-07-18 16:50:00 | 96.7386795568982880
- 2019-07-18 17:00:00 | 96.7374891012145749
- 2019-07-18 17:10:00 | 96.7130741014444071
- 2019-07-18 17:20:00 | 96.7375723304231028
- 2019-07-18 17:30:00 | 96.7608699481865285
- 2019-07-18 17:40:00 | 96.7619785870112435
- 2019-07-18 17:50:00 | 96.7608281206061553
- 2019-07-18 18:00:00 | 96.7529708272624251
- 2019-07-18 18:10:00 | 96.7710412090680101
- 2019-07-18 18:20:00 | 96.7613239327296248
- 2019-07-18 18:30:00 | 96.7784616780045351
- mp=> select * from config_workperformacerange;
- id | performance | start | end
- ----+-------------+----------+-----------
- 1 | 1 | 92.0000 | 96.0000
- 2 | 2 | 96.0001 | 100.0000
- 3 | 3 | 100.0001 | 105.0000
- 4 | 4 | 105.0001 | 110.0000
- 5 | 5 | 110.0001 | 120.0000
- 6 | 6 | 120.0001 | 9999.0000
- (6 rows)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement