MySQL如何将具有SELECT子查询的表插入返回多行的表?
INSERT INTO Results ( People, names, ) VALUES ( ( SELECT d.id FROM Names f JOIN People d ON d.id = f.id ), ( "Henry" ), );
我 WANT 来填充新表与此子查询返回的所有结果。我如何做到这一点而又没有收到 错误1242(21000):子查询返回的行多于1
INSERT INTO Results (People, names ) SELECT d.id, 'Henry' FROM Names f JOIN People d ON d.id = f.id
将静态字符串Henry与您的SELECT查询结合。
Henry
SELECT