以下两个查询实现了我想要对我的表执行的操作:
Update person_role_memberships, events
set person_role_id = 2
where person_role_id = 32 and event_name = events.name and events.date_2 = curdate() - 1
;
-
update person_role_memberships set person_role_id = 2
where person_role_id = 32 and event_name in
(select name from events where date_2 = curdate() -1
);
我想知道在最优性、安全性(极端情况或副作用)或最佳实践方面哪种方法更好?