[英]How do I do select into from another table
Basically I want to run a SQL statement like this, but I can't due to errors. 基本上,我想运行这样的SQL语句,但是由于错误而不能。 Not sure why?
不知道为什么吗?
INSERT INTO allevent (eventname)
VALUES (select username from registered)
Msg 156, Level 15, State 1, Line 1
消息156,第15级,状态1,第1行
Incorrect syntax near the keyword 'select'.关键字“ select”附近的语法不正确。
Msg 102, Level 15, State 1, Line 1
Msg 102,第15级,状态1,第1行
Incorrect syntax near ')'.')'附近的语法不正确。
No need of parentheses around the SELECT
statement in your query. 在查询中的
SELECT
语句周围不需要括号。
INSERT INTO allevent (eventname)
SELECT username FROM registered
Parentheses with VALUES
required, where some places like below: 括号内必须有
VALUES
,如下所示:
INSERT INTO tablename (fieldname)
VALUES ('field 01'), ('field 02');
Please find the syntax for the INSERT
statement. 请找到
INSERT
语句的语法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.