我可以联接两个表,但是我试图将它们另存为新表,但一直说我的选择语法错误?
我对SQL Server非常陌生
Create table New_table AS
SELECT *
from Old_Table inner join id on Old_table.id=Other_table.id
答案 0 :(得分:1)
您需要SELECT ... INTO
:
SELECT Old_table.id
, Old_table.foo
, Other_Table.bar
, Other_Table.foo AS baz -- foo has to be renamed, can't have two columns with the same name
INTO New_table
FROM Old_Table
INNER
JOIN Other_Table
ON Old_table.id = Other_table.id