MySQL: update without changing data, possible?

喜欢而已 提交于 2020-08-07 01:35:03

问题


Is it possible in MySQL to update a row, without changing any data?

I just need a trigger to do its work, but the data should not be changed.

Of course I could do an update and then another update, but the trigger is quite slow (deletes and inserts 500 rows everytime) and I have to update thousands of rows, so I'd rather not do it twice.

I could also just update a dummy field with NOW(), but I'm just curious if it's possible without 'tricks'.


回答1:


How about:

UPDATE table SET id=id WHERE ...



回答2:


You should just be able to run an UPDATE command with the same data that already exists in the row. No data will change, but the trigger will still fire.



来源:https://stackoverflow.com/questions/7408506/mysql-update-without-changing-data-possible

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!