MySQL:更新而不更改数据,可能吗? [英] MySQL: update without changing data, possible?

查看:260
本文介绍了MySQL:更新而不更改数据,可能吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MySQL中是否可以在不更改任何数据的情况下更新行?

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.

我当然可以先进行更新,然后再进行一次更新,但是触发器的速度非常慢(每次删除并插入500行),而且我必须更新数千行,因此我不想重复执行两次.

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.

我还可以使用NOW()更新一个虚拟字段,但是我很好奇是否有可能不使用技巧".

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

推荐答案

怎么样:

UPDATE table SET id=id WHERE ...

这篇关于MySQL:更新而不更改数据,可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆