Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8524655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T07:44:59+00:00 2026-06-11T07:44:59+00:00

I have a table with data: BID USER RETRACTED 1500 75 0 1900 75

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T07:45:01+00:00Added an answer on June 11, 2026 at 7:45 am

    This would be easiest in parts:

    1. First, delete the bids belonging to the retracted user.
    2. Then, select the user ID of the highest bidder.
    3. Next, find the highest bid that was not made by the highest bidder.
    4. Get the lowest bid higher than the one found in step 3. This will be the new high bid.
    5. Finally, delete all but one of the high bids.

    Something like this:

    DELETE FROM bids WHERE user=1010;
    SET @highbidder=(SELECT user FROM bids ORDER BY bid DESC LIMIT 1;
    SET @secondbid=(SELECT bid FROM bids WHERE user != @highbidder ORDER BY bid DESC LIMIT 1);
    SET @newhigh=(SELECT bid FROM bids WHERE bid > @secondbid ORDER BY bid ASC LIMIT 1)
    DELETE FROM bids WHERE bid > @newhigh;
    

    The three SET statements could be condensed:

    SET @newhigh=(SELECT bid FROM bids WHERE bid > (SELECT bid FROM bids WHERE user != (SELECT user FROM bids ORDER BY bid DESC LIMIT 1) ORDER BY bid DESC LIMIT 1) ORDER BY bid ASC LIMIT 1);
    

    However I don’t think that’s a good idea, partly for performance reasons but mostly for readability.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a following table: bid | data 1 | a 1 | b
I have a table with a field name BID with its data type set
I have table of data that is sorted as follows: Item | Sample |
I have table in data base name train delay, with columns train number(int), DelayTime(int),
I do have a table data as shown below: <td> <label for=title>Title : </label>
My table have data structure like this cate_id task_id date_start date_end other 34 14
I have data table containing one column as FilePath. FilePath D:\New folder\link.txt D:\New folder\SharepointMigration(Work
I have a table containing data about some users. Many of them use our
I have a table of data that I need to dynamically add a column
I have a table of data which represents a series of events that persons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.