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

I use the above code in postgresql but it says:

ERROR: syntax error at or near ")" LINE 3: ) AS ( ^

****** Error ******

ERROR: syntax error at or near ")" SQL state: 42601 Character: 55

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

user3315620
  • 229
  • 2
  • 4
  • 12
  • See http://stackoverflow.com/questions/15691243/creating-temporary-tables-in-sql – John Powell May 28 '14 at 21:42
  • Is it really that hard to read the manual? http://www.postgresql.org/docs/current/static/sql-createtableas.html –  May 28 '14 at 22:57

1 Answers1

0

It is much simpler than your try:

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

SeeCREATE TABLE AS

klin
  • 112,967
  • 15
  • 204
  • 232