首页 文章

如何在postgresql中创建带有AS的临时表?

提问于
浏览
-2
Create Temporary Table Temp3 ( 
user_id int not null,
) AS query(
select id 
from users
)

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

错误:语法错误在或附近“)”LINE 3:)AS(^

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

错误:语法错误在或附近“)”SQL状态:42601字符:55

How can I fix it to do the same job? Thx ahead!

1 回答

  • 0

    它比你的尝试简单得多:

    create temporary table Temp3 as
        select id as user_id
        from users;
    

    CREATE TABLE AS

相关问题