使用以下sql语句时:
UPDATE nsuppliercomponent
INNER JOIN nsuppliercomponent ON supplier.supplierName = nsuppliercomponent.supplierId
SET nsuppliercomponent.supplierId = supplier.supplierId WHERE
nsuppliercomponent.supplierId = supplier.supplierName;
我收到以下错误消息:
Error
SQL query:
UPDATE nsuppliercomponent
INNER JOIN nsuppliercomponent ON supplier.supplierName = nsuppliercomponent.supplierId
SET nsuppliercomponent.supplierId = supplier.supplierId WHERE
nsuppliercomponent.supplierId = supplier.supplierName
MySQL said: Documentation
# 1066 - Not unique table/alias: 'nsuppliercomponent'
我在表A中有2个表,我在表B中存储供应商的所有编号,我存储供应商自己。我想在后面使用foreignkeys来解释为什么我需要将supplierid从tablea中更改,此时所有内容都存储为包含名称的字符串,并使用正确的supplierid将其转换为int
下表:表A:
表B:
1条答案
按热度按时间icomxhvb1#
简单的输入错误,我认为,你加入同一个表两次,而不是
supplier
表格: