我正在尝试使用PostgreSQL中的函数在WITH中创建临时表.
示例:
with mm
as
(
select * from test
)
create table xyz as select * from mm
;
Run Code Online (Sandbox Code Playgroud)
注意:在创建附近获取错误
Tom*_*eif 14
create table xyz as
with mm
as
(
select * from test
)
select * from mm
where myfield = myvalue
;
Run Code Online (Sandbox Code Playgroud)
相关文件.在文档中,没有关于如何create table as与CTE一起使用的明确说明.但是它清楚地说明了它的语法(简化):
CREATE TABLE table_name
AS query
Run Code Online (Sandbox Code Playgroud)
查询可以在哪里(引用):
SELECT,TABLE或VALUES命令,或运行准备好的SELECT,TABLE或VALUES查询的EXECUTE命令.
由此可以清楚地说明为什么你的尝试失败了.
| 归档时间: |
|
| 查看次数: |
4284 次 |
| 最近记录: |