Reputation: 1
Please can someone assist ,
I have two tables, Item table and Import table with many rows
I need to insert Import.Price into Item.BuydownPrice
where the import.barcode = item.itemlookupcode
Kind Regards
Upvotes: 0
Views: 681
Reputation: 1792
It sounds like you are confusing concepts. Inserting values from one table's column into another table's column is very straightforward. However, in that context, that where
condition wouldn't make much sense.
It sounds to me (but tell me if I'm wrong) that you are trying to add the Price
column to your Item
table with a join:
select a.*, b.Price as BuyDownPrice
from item a
left join import b
on a.itemlookupcode = b.barcode
Upvotes: 1
Reputation: 2306
update a
set a.BuydownPrice = b.Price
FROM BuydownPrice AS a INNER JOIN
Item AS b ON a.barcode = b.itemlookupcode
Upvotes: 0