mercredi 25 février 2015

Inserting values into a column when Table1 column A value matches Table 2 Column B Value


I have two tables ImportData and PurchaseInfo. I am trying to import [Supplier Contact Name] from ImportData to PurchaseInfo, when *[SupplierName] in ImportData = *[SupplierName] in PurchaseInfo


This is the query I tried:



INSERT INTO PurchaseInfo ([Supplier Contact Name])
SELECT [Supplier Contact Name] from ImportData WHERE PurchaseInfo.[Supplier Name] = SupplierInfo.SupplierName


I get the error


Msg 4104, Level 16, State 1, Line 2 The multi-part identifier "PurchaseInfo.Supplier Name" could not be bound.


Any help would be greatly appreciated.





Aucun commentaire:

Enregistrer un commentaire