I have more than 26.4 million rows in table a "item"to be updated. i am using this query to update but it takes too much time aprox more than 4 hours and continue running. Is it correct query or there is better way to update it? Need your help
UPDATE item a
JOIN cost b ON a.order_id = b.order_id
AND YEAR(a.date) = b.YEAR
AND month(a.date) = b.month
AND hour(a.time) = b.hour
SET a.cost = b.cost
query was obtained from below discussion it is running but taking too much time.
Update table if conditions met. (update the value from table b to a) corresponding value required