marmite Posted April 20, 2007 Share Posted April 20, 2007 It seems that I can't use MAX in this way in SQL. However, I need to decrement the figure by one, but not going below 0. Does anyone know how I could do this in SQL? Or do I need an IF stmt in PHP? Thanks... Link to comment https://forums.phpfreaks.com/topic/47873-solved-update-users-set-imagesmax0images-1-where-useridx/ Share on other sites More sharing options...
Tyche Posted April 20, 2007 Share Posted April 20, 2007 Why not try UPDATE users SET images=images-1 WHERE userid=x AND images > 0; Link to comment https://forums.phpfreaks.com/topic/47873-solved-update-users-set-imagesmax0images-1-where-useridx/#findComment-233893 Share on other sites More sharing options...
marmite Posted April 20, 2007 Author Share Posted April 20, 2007 Oh yeah! Thanks! Link to comment https://forums.phpfreaks.com/topic/47873-solved-update-users-set-imagesmax0images-1-where-useridx/#findComment-233920 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.