PSQL中的CTE / with子句

时间:2018-05-23 18:19:22

标签: sql common-table-expression greenplum

我收到错误:

  

执行以下操作时“INSERT”*处或附近的语法错误:

WITH
    sq as (select * from input_client)
INSERT INTO cleaned
select *
  from weekly
    cross join sq;

参考(红色)手册的语法: https://www.postgresql.org/docs/9.1/static/queries-with.html

1 个答案:

答案 0 :(得分:0)

INSERT INTO cleaned
select w.*
from weekly w, input_client;

如果您只想要一个input_client和每周的笛卡尔积,那就这样写吧。