For the following table (all columns are integers)
[id, value, best_value]
For a given id and value I want update it’s row setting the best_value column to max(newvalue,best_value). I seached into the documentation but I dont see a function for doing so.
Thanks
You want
GREATEST(x,y). Example, if the new value is 530:UPDATE my_table SET best_value = GREATEST(530,best_value) WHERE id=123