Update column in database where max value php mysql

前端 未结 2 797
温柔的废话
温柔的废话 2021-01-29 07:32

I got problem here. im updating name where B has the biggest value.

so the results are

B  | name
---|------
 1 | 
 2 | 
 3 | YES

but wh

2条回答
  •  无人共我
    2021-01-29 08:37

    You have to run UPDATE products set name = ''; everytime and then :

    UPDATE products set name = 'YES'
    WHERE B > 0
    ORDER BY B DESC
    

提交回复
热议问题