我需要找到一种方法来做,INSERT INTO table A
但其中一个值来自对表 B 的查找,请允许我进行说明。
我有以下 2 个表格:
表 A:
A1: String
A2: Integer value coming from table B
A3: More Data
表 B:
B1: String
B2: Integer Value
A 的示例行:{"Value", 101, MoreData} B 的示例行:{"English", 101}
现在,我知道我需要将以下内容插入 A {"Value2", "English", MoreData} 但显然这不起作用,因为它期望第二列中的 Integer 而不是单词“English”,所以我需要首先在表 B 中进行查找。
像这样的东西:
INSERT INTO tableA (A1, A2, A3)
VALUES ("Value2", SELECT B2 FROM tableB where B1="English", MoreData);
显然这不能按原样工作......
有什么建议么?