我有这个更新查询.
UPDATE production_shr_01
SET total_hours = hours, total_weight = weight, percentage = total_hours / 7893.3
WHERE (status = 'X')
Run Code Online (Sandbox Code Playgroud)
查询执行正常,但问题是当执行此查询时,它不会更新百分比字段.可能是什么问题?
小智 5
status ='X'找不到任何行或(并且下一个更有可能),因为你在同一语句中更新total_hours,total_hours可能是0(或NULL),因此没有更新; 我建议您使用hours字段进行更新,如下所示:
UPDATE production_shr_01
SET total_hours = hours, total_weight = weight, percentage = hours / 7893.3
WHERE (status = 'X')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
118 次 |
| 最近记录: |