我有以下3个表,data_excel包含Person的姓名、地址、城市和来源;person表包含姓名和ID;我需要在person_location中插入来自person表的address source、address、city和ID...where ID,并且应该在Data_Excel表中匹配与id对应的姓名,以获取所有详细信息

发布于 2013-11-20 22:42:59
看一下这个very similar question,它应该提供您需要应用于您自己的问题的信息。
发布于 2013-11-20 22:52:48
错误可能来自查询A.name, A.ID in (Select[...]的这一部分
你可以试试..。
INSERT INTO person_location
SELECT A.ID,A.P_name,source,P_address,P_city,P_country from data_excel de, person A where A.name = de.c_name;如果需要ID > 6566条件,可以在末尾添加。
INSERT INTO person_location
SELECT A.ID,A.P_name,source,P_address,P_city,P_country from data_excel de, person A where A.name = de.c_name and ID > 6566;https://stackoverflow.com/questions/20098831
复制相似问题