Php 更新1个数据库列中的多个结果

Php 更新1个数据库列中的多个结果,php,mysql,Php,Mysql,尝试更新1个数据库列中的多个结果首先需要获取以前的值,而不是更新为新值。到目前为止,我编写了此查询,但它不起作用。请参见代码查询和当前结果 代码 我得到了错误的结果 预期结果 有人能纠正我吗。。。我想更新当前结果除以100,你可以直接使用一个查询 update user_pages set actual_grand_total = actual_grand_total/100 , grand_total = grand_total/100 actual_g

尝试更新1个数据库列中的多个结果首先需要获取以前的值,而不是更新为新值。到目前为止,我编写了此查询,但它不起作用。请参见代码查询和当前结果

代码

我得到了错误的结果

预期结果


有人能纠正我吗。。。我想更新当前结果除以100,你可以直接使用一个查询

   update user_pages 
   set  actual_grand_total = actual_grand_total/100 ,  
        grand_total = grand_total/100 
actual_grand_total | grand_total
------------------   -----------
       1000             750     
       5000             500     
       7500             750     
    actual_grand_total | grand_total
    ------------------   -----------
           1.000             1.000     
           1.000             1.000     
           1.000             1.000  
 actual_grand_total | grand_total
    ------------------   -----------
           10             7.5     
           50             5     
           75             7.5     
   update user_pages 
   set  actual_grand_total = actual_grand_total/100 ,  
        grand_total = grand_total/100