[MySQL] UPDATE Clause

Hello.

I Need a rather simple update query.

USER ~#

Ronald 5000
Ronald 4000
Ronald 3000

Now I am getting new value , e.g 5600 ( that’s bigger than 1st row in the table )
so I need update query for UPDATE a minimal row with this one i.e “Ronald 3000”

New table should look:

USER ~#

Ronald 5000
Ronald 4000
Ronald 5600

That’s look really simple , but I am not experienced in sql so much.


UPDATE tbl
   SET score = 5600
 WHERE name = 'Ronald'
ORDER 
    BY score ASC
 LIMIT 1

Hopefully you only have one ronald in the table.

thanks