当前位置:
首页 >
mysql 更新多条id键值相同记录中的最新(最后一条)记录
发布时间:2025/10/17
74
豆豆
生活随笔
收集整理的这篇文章主要介绍了
mysql 更新多条id键值相同记录中的最新(最后一条)记录
小编觉得挺不错的,现在分享给大家,帮大家做个参考.
例如上表(memorystorage表):
每次退柜操作时,要把退柜时间return_time更新(0000-00-00 00:00:00 -> $nowtime)
update memorystorage set return_time = $nowtime' where return_time = ( select A.return_time from
(select return_time from memorystorage where student_id = '25'order by get_time desc limit 1)as A)
要将select出的结果再通过中间表select一遍,这样就规避了错误。注意,这个问题只出现于mysql,mssql和oracle不会出现此问题。
error:You can't specify target table 'memorystorage' for update in FROM clause!!!
总结
以上是生活随笔为你收集整理的mysql 更新多条id键值相同记录中的最新(最后一条)记录的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: php 提交网页 传值 获取编辑框的值
- 下一篇: 完美解决Flask-Migrate使用S