JCKalt / General-Work

Modeling database
0 stars 0 forks source link

[dbui] - data_hist views #120

Open JCKalt opened 1 year ago

JCKalt commented 1 year ago

adding ability to replicate Christi's queries

JCKalt commented 1 year ago

Modify current dbui view to use this query.

SELECT day_report_date, ROUND((SUM(wh1)/1000)::numeric, 3) AS kwh1, ROUND((SUM(wh2)/1000)::numeric, 3) AS kwh2, ROUND((SUM(wh3)/1000)::numeric, 3) AS kwh3, ROUND((SUM(total_wh)/1000)::numeric, 3) AS total_kwh FROM device_hist h WHERE device_serial = :device_serial_choosen GROUP BY day_report_date HAVING SUM(total_wh) > 0 ORDER BY day_report_date;