I have a temp table on my DB called CSV_Import that I import XLS files into, this table has 2 rows, SKU and EAN.
I am trying to build a query needs to reference the SKU from the CSV_Import table, then find the SKU in either the Product or ProductVariant table and update the DownloadLocation row in ProductVariant (where we place our EAN's).
I am struggling when a product has many variants and many different SKU's as none of the fields in the SKU row on the table Product have an entry. What happens then is that the SKUSuffix row on the ProductVariant table will have the entry that needs to be queried.
This the SQL Query that I have at the moment....
UPDATE ProductVariant
SET DownloadLocation = CSV_Import.ean
FROM ProductVariant AS ProductVariant
INNER JOIN Product AS Product ON ProductVariant.ProductID=Product.ProductID
INNER JOIN CSV_Import ON Product.SKU = CSV_Import.SKU
Can anyone offer some help?