我有想要导入mySQL数据库的数据,但前提是表2中有匹配的电子邮件地址。
INSERT INTO table_1 VALUE data_1, email
WHERE email *exists in table_2*
我不确定我是否正确解释,如果您需要更多信息,请告诉我。
谢谢!
答案 0 :(得分:2)
INSERT INTO table1(data_1, email)
VALUES
(SELECT data_1,email
FROM table_2
WHERE table_1.email=table2.email)
答案 1 :(得分:1)
INSERT INTO table_1 VALUE data_1, email
WHERE email IN (SELECT email FROM table_2)