我有一个带有 with 子句的 sql 语句,我想用 insert into 将结果写入一个表中。我尝试过的 with 和 insert into 的任何组合都会给我一条错误消息。我想做的最小例子:
create table temp as (quarter decimal(5));
insert into temp (
with bla as (select 2021 as year from dummy)
select 10*year + 1 as quarter from bla
)
将 with 语句放在 insert into 之外也不起作用。