I am trying to update a column in table, based on data (that is constantly updated) in a temporary table (via csv imports). The date in the temporary table is VARCHAR ("2/20/2014 10:29:25 AM" format) and the date in the table I want to update is in DATETIME type.
I'm not sure how to properly join these two tables to update the dates in the permanent table based on the current date showing in the temp table...using product_sku (in both tables) as the joining field.
Here is what I have tried, but keep getting SQL error (' #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM...)
Update t0
set t0.product_available_date =
(SELECT STR_TO_DATE( `t1.product_available_date`,
'%c/%e/%Y %H:%i' ))
FROM cpg5443_virtuemart_products as t0
join cpg5443_virtuemart_products_temp as t1
on t0.product_sku = t1.product_sku
Where t0.product_sku='002-765-AS'
Do you see any glaring mistakes and can you advise how I can correct? In the end, I will want the where statement to say "where t0.product_sku=t1.product_sku" with hopes this will update this column for every record based on the date in the temp table. For now, I'm just testing the update with one product_sku.