Let t be a mysql table and n be an integer column in it. I would be interested if the following query can be modified so that the expression n - 10 is calculated only once.
UPDATE t SET n = if(n - 10 < 1, 1, n - 10) WHERE n = 5;
The query does not make sense, I know, but I need to use the same pattern in the real application where values 10 and 5 would be php variables.
 
    