优化荆楚水库雨量实时表

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

@ -13,6 +13,9 @@
(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 '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 '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 '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 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} 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}
) )