java多并发下更新查询问题

biantiandiyun 2013-11-11 10:00:27
在多线程情况下,执行 update table_name set col1 = 'A' where field1 = (select field1 from table_name where col2 = ? and col1<>'A' fetch FIRST 1 ROWS ONLY)为什么会更新同一条数据?
...全文
547 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
yangxiao_jiang 2013-11-14
  • 打赏
  • 举报
回复
update table_name set col1 = 'A' where field1 = (select field1 from table_name where col2 = ? and col1<>'A' order by rand() fetch FIRST 1 ROWS ONLY)

5,888

社区成员

发帖
与我相关
我的任务
社区描述
IBM DB2 是美国IBM公司开发的一套关系型数据库管理系统,它主要的运行环境为UNIX(包括IBM自家的AIX)、Linux、IBM i(旧称OS/400)、z/OS,以及Windows服务器版本
社区管理员
  • DB2
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧