超级表结构:CREATE STABLE IF NOT EXISTS s_pulse (ts TIMESTAMP, val DOUBLE , prop INT) TAGS (id INT ,factory_id INT ,equip_id INT);
sql:
select _wstart as ts , (last(val) - first(val)) as val from jlbk.s_pulse
where id in ( 1434 ) and ts >= “2025-01-01 00:00:00.0” AND ts < “2026-01-01 00:00:00.0” partition by id INTERVAL(1n ,AUTO ) fill(null);
select _wstart as ts , (last(val) - first(val)) as val, id, first(factory_id) as factory_id, first(equip_id) as equip_id, first(prop) as prop from jlbk.s_pulse
where id in ( 1434 ) and ts >= “2025-01-01 00:00:00.0” AND ts < “2026-01-01 00:00:00.0” partition by id INTERVAL(1n ,AUTO ) fill(null);
select _wstart as ts , (last(val) - first(val)) as val, id, first(factory_id) as factory_id, first(equip_id) as equip_id, first(prop) as prop from jlbk.s_pulse
where id in ( 1434 ) and ts >= “2025-01-01 00:00:00.0” AND ts < “2026-01-01 00:00:00.0” partition by id INTERVAL(1n) fill(null);