ratacheski

Select medição geração por hora

Sep 29th, 2020
1,358
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT sm.id,
  2.        sm.denominacao,
  3.        date_trunc('hour', m.data_medicao) as medicao,
  4.        SUM(m.potencia_ativa) as potencia_ativa,
  5.        SUM(m.potencia_reativa) as potencia_reativa
  6. from sideufg_medicao m
  7.          INNER JOIN sideufg_medidor sm on sm.id = m.medidor_id
  8. WHERE sm.id IN
  9.       (2023001, 2037001, 1093001, 1094001, 1095001, 1096001, 1097001, 1098001, 1099001, 1100001, 1101001, 1102001)
  10. GROUP BY 3, sm.id
  11. ORDER BY 3;
RAW Paste Data