mysql - Updating a double value, but not higher than x value? -
update base_resources set value = value + ? resource_id = ? , base_id = ?
i have query. possible somehow add max value the value? i.e. new value of "value" cannot higher x, if is, set x.
for example:
if value entered (1500) , max value allowed (that conditional want add in query is) 1000, value 1000 instead.
how can that?
something this:
update base_resources set value = least(value + ?, 1500) resource_id = ? , base_id = ?
Comments
Post a Comment