Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/postgresql/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在postgresql中使用AS创建临时表?_Sql_Postgresql - Fatal编程技术网

如何在postgresql中使用AS创建临时表?

如何在postgresql中使用AS创建临时表?,sql,postgresql,Sql,Postgresql,我在postgresql中使用了上面的代码,但上面说: 错误:语法错误位于或接近“)” 第3行:)作为( ^ ******错误********* 错误:语法错误位于或接近“)” SQL状态:42601 人物:55 如何修复它以执行相同的工作?前进这比您的尝试简单得多: Create Temporary Table Temp3 ( user_id int not null, ) AS query( select id from users ) 参见参见阅读手册真的有那么难吗? create

我在postgresql中使用了上面的代码,但上面说:

错误:语法错误位于或接近“)” 第3行:)作为( ^

******错误*********

错误:语法错误位于或接近“)” SQL状态:42601 人物:55


如何修复它以执行相同的工作?前进

这比您的尝试简单得多:

Create Temporary Table Temp3 ( 
user_id int not null,
) AS query(
select id 
from users
)

参见

参见阅读手册真的有那么难吗?
create temporary table Temp3 as
    select id as user_id
    from users;