Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我写了这个查询
INSERT INTO table1 set Name=(SELECT Name FROM table2)
它给出了#1242 - 子查询返回超过 1 行错误,
请帮助我正确查询。
谢谢,克里希纳
你的语法INSERT INTO ... SELECT是错误的。尝试
INSERT INTO ... SELECT
INSERT INTO table1 (Name) SELECT Name FROM table2
这是SQLFiddle演示。
我认为你应该做INSERT INTO...SELECT声明,
INSERT INTO...SELECT
INSERT INTO table1 (Name) SELECT DISTINCT Name FROM table2