通过从 With 语句创建的 Select 语句插入数据来创建 Table

Create Table by Inserting Data from Select Statement created by With Statement

我有一个非常复杂的 with 语句,它结合了很多信息以在 teradata studio 中用 select 语句获取。 with 语句非常有效,selects 是我需要的数据,但我不知道如何从中创建视图,或将其保存为持久性 table,或对其执行任何操作这将使它成为 select 数据的持久方式。我想使用此 with 语句将 select 语句保存为持久性 table,然后我可以从 ec2 实例中使用 tpt 脚本中提取它。

我曾经创建 volatile tables 而不是使用 with 语句,我可以通过执行正确的 select 和 insert 语句来创建 table。但是,这将被放入生产环境并进行安排,他们对此并不满意,并表示将其包装在 with 声明中。

我试过将整个 with 语句包装到一个 create table 或 create view 语句中。我试过更改获取数据的 select 语句并将其转换为 create table 或 insert into 语句,但其中 none 似乎与 with 语句语法合作。

WITH
customer_month_ad AS
(

),

months_since_last_payment AS
(

),

customer_month_2 AS
(

),

customer_month AS
(

),

date_things AS
(

),


network AS
(

),

skeleton AS
(

),

customer_stuff AS
(

),

customer_keyz AS
(

),

customer_activity AS
(

),

order_date AS (

),

months AS
(

)--,

SELECT *
FROM customer_month_ad
;

我想将 select 语句的输出保存到持久性 table 中。

试试这个查询

create table <your_table_name> as select * from <table_names>

create table <your_table_name> as <your_select_statement>

替换:

<your_table_name> 由结果的名称 table

<table_names> table 数据来源

的名称

<your_select_statement> 通过 select 语句,如果你有一个不同的

不像select * from .......