SHARE
TWEET

Untitled

a guest Jul 19th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 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;
  2.  
  3.  
  4.       read_date      |         sum        
  5. ---------------------+---------------------
  6.  2019-07-18 16:50:00 | 96.7386795568982880
  7.  2019-07-18 17:00:00 | 96.7374891012145749
  8.  2019-07-18 17:10:00 | 96.7130741014444071
  9.  2019-07-18 17:20:00 | 96.7375723304231028
  10.  2019-07-18 17:30:00 | 96.7608699481865285
  11.  2019-07-18 17:40:00 | 96.7619785870112435
  12.  2019-07-18 17:50:00 | 96.7608281206061553
  13.  2019-07-18 18:00:00 | 96.7529708272624251
  14.  2019-07-18 18:10:00 | 96.7710412090680101
  15.  2019-07-18 18:20:00 | 96.7613239327296248
  16.  2019-07-18 18:30:00 | 96.7784616780045351
  17.  
  18.  
  19. mp=> select * from config_workperformacerange;
  20.  id | performance |  start   |    end    
  21. ----+-------------+----------+-----------
  22.   1 |           1 |  92.0000 |   96.0000
  23.   2 |           2 |  96.0001 |  100.0000
  24.   3 |           3 | 100.0001 |  105.0000
  25.   4 |           4 | 105.0001 |  110.0000
  26.   5 |           5 | 110.0001 |  120.0000
  27.   6 |           6 | 120.0001 | 9999.0000
  28. (6 rows)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top