作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个表,除其他外,还包含以下字段:id 整数、status_id 整数、add_date 日期
。
我想执行类似这样的查询:
更新表集 status_id = new_status_id where status_id = old_status_id
但是它只会更新给定百分比的值,比如 50%。此外,每个日期更新行的分布应该是相似的;我想要更新 date = 23.06.2013
的一半行,一半不更新。
最佳答案
update table
set status_id = new_status_id
where
status_id = old_status_id
and random() < 0.5
关于sql - 如何只更新一定比例的匹配值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17223612/
我是一名优秀的程序员,十分优秀!