优化荆楚水库雨量实时表

master
chenxiwang 2024-08-20 16:34:25 +08:00
parent e438b1c5e6
commit e00ea1a642
1 changed files with 6 additions and 3 deletions

View File

@ -10,9 +10,12 @@
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN (date_trunc('day', t1.tm) + interval '8 hour') AND (date_trunc('day', t1.tm) + interval '1 day' - interval '1 second')) today,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '10 min' and t1.tm) m10,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '30 min' and t1.tm) m30,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '1 hour' and t1.tm) h1,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '3 hour' and t1.tm) h3,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '6 hour' and t1.tm) h6,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '1 hour' and t1.tm) h1,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '3 hour' and t1.tm) h3,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '6 hour' and t1.tm) h6,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '12 hour' and t1.tm) h12,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '24 hour' and t1.tm) h24,
(select sum(t3.drp) from st_pptn_r t3 where t3.stcd=t1.stcd and t3.tm BETWEEN t1.tm - interval '48 hour' and t1.tm) h48,
CURRENT_TIMESTAMP chtm
from st_pptn_r t1 where exists(select 1 from m1 t2 where t2.stcd=t1.stcd and t2.tmx=t1.tm) and stcd = #{stcd}
)