I want to copy the "date_email2" data for "18458" id to some specific order id like 18460 and 18468. Can anyone please help me what is the easiest way to do it
I assume your table is called orders so you can update this like this
UPDATE orders
SET date_email2 = (SELECT date_email2 FROM (SELECT * FROM orders) o WHERE id_order = 18458 ORDER By date_email2 DESC LIMIT 1)
WHERE id_order IN (18460 , 18468)
update mytable t cross join
(select t2.*
from mytable t2
where t2.id_order = 18458
) t2
set t.date_email2 = t2.date_email2
where t.id_order in (18460, 18468);
2
Answers
I assume your table is called orders so you can update this like this
You can use
join
in MySQL: