Table 1 - leads
column 1 - lead_source_description
Table 2 - leads_cstm
column 2 -referrer_c
我正在尝试使用以下查询将值从table2.column2
复制到table1.column1
INSERT INTO leads (`lead_source_description`)
SELECT `referrer__c`
FROM leads_cstm
我知道安静是一项简单的任务,并且已经被问到了。但是我收到以下错误。
#1062 - Duplicate entry '' for key 'PRIMARY'
答案 0 :(得分:0)
您的“潜在客户”表必须具有自动增量ID值,您需要像这样插入:
INSERT INTO leads (SELECT NULL, table1.column1 , '', ....) // all the column of leads table shoudl be inserted
答案 1 :(得分:0)
INSERT INTO leads (`lead_source_description`)
SELECT DISTINCT `referrer__c` FROM leads_cstm