I have a table with data:
BID USER RETRACTED
1500 75 0
1900 75 0
2000 75 0
2000 75 0
2500 586 0
2750 75 0
3000 75 0
3250 1010 0
3500 75 0
3750 1010 0
4000 75 0
This is a bidding platform but the problem I am struggling with is that users are able to retract their bids. If they do then the information in the DB needs to be amended. Bids are placed in increments.
Currently I have that if USER 1010 retracts their bid, the highest bid is still 4000 when I actually need it to be 2750 because that is the highest value between 2 USERS.
This would be easiest in parts:
Something like this:
The three
SETstatements could be condensed:However I don’t think that’s a good idea, partly for performance reasons but mostly for readability.