我需要插入如下行:
INSERT INTO table1 (id, name) VALUES (1, SELECT otherName FROM table2);
在 SQLite 中可以吗?
最佳答案
这是您正在寻找的语法:
INSERT INTO table1 (id, name)
SELECT 1, otherName
FROM table2
看看this SO article其中涵盖了类似的问题。
关于SQLite 插入值并选择,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31178822/