Jump to content

MYSQL Update with maximum value


BuildMyWeb

Recommended Posts

Im having a hard time even explaining this so a search was not fruitful. 

 

I have an INT column in a mysql table.  i want to UPDATE it in increments of 10 but the value should never exceed 100.  what is an efficient way to do this?

 

ie.  if the current value in the field is 96, when it tried to update

field = field+10

, it should dynamically only be

field = field+4

so that we do not exceed the 100 mark.

Link to comment
https://forums.phpfreaks.com/topic/292852-mysql-update-with-maximum-value/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.