Advertisement
ratacheski

view vw_medicao_hora_geracao

Sep 29th, 2020
1,438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. create or replace view vw_medicao_hora_geracao(id_medidor, nome_medidor, data_medicao, potencia_ativa, potencia_reativa) as
  2. SELECT sm.id,
  3.        sm.denominacao,
  4.        date_trunc('hour', m.data_medicao) as medicao,
  5.        SUM(m.potencia_ativa) as potencia_ativa,
  6.        SUM(m.potencia_reativa) as potencia_reativa
  7. from sideufg_medicao m
  8.          INNER JOIN sideufg_medidor sm on sm.id = m.medidor_id
  9. WHERE sm.id IN
  10.       (2023001, 2037001, 1093001, 1094001, 1095001, 1096001, 1097001, 1098001, 1099001, 1100001, 1101001, 1102001)
  11. GROUP BY 3, sm.id
  12. ORDER BY 3;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement