MySQL: updating without changing data, maybe?

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

I just need a trigger to get it working, but the data should not be changed.

Of course, I could do an update, and then another update, but the trigger is pretty slow (it deletes and inserts 500 lines each time), and I need to update thousands of lines, so I would rather not do it twice.

I could just update the dummy field with NOW (), but I'm just wondering if this is possible without the β€œtricks”.

+4
source share
2 answers

What about:

UPDATE table SET id=id WHERE ... 
+4
source

You should simply run the UPDATE command with the same data that already exists in the row. No data will be changed, but the trigger will still fire.

+2
source

All Articles