如何将(WITH Queries)的结果放入新表中。
相关代码为:
WITH A as (
SELECT ambtemp,dt,
date_trunc('hour', dt)+
CASE WHEN date_part('minute', dt) >= 30
THEN interval '30 minutes'
ELSE interval '0 minutes'
END as t
FROM temm),
B as(
SELECT ambtemp,dt,
max(ambtemp::float(23)) OVER (PARTITION BY t) as max_temp,
min(ambtemp::float(23)) OVER (PARTITION BY t) as min_temp
FROM A)
SELECT ambtemp,dt
FROM B
WHERE (max_temp - min_temp) <= 0.2
我需要将结果放入一个新表中。