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 8864911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:22:15+00:00 2026-06-14T16:22:15+00:00

Well I have this mysql table with numbers in one column and a confirmation

  • 0

Well I have this mysql table with numbers in one column and a confirmation boolean of 0 or 1 and I have about 1,000 rows so it’s not something I can do manually but anyways…
I want to sort the row by highest value and grab the names of the first 5 people and put those 5 people in another table on a column and then set them to confirmed and continue until there’s no one left in the table that isn’t confirmed…
ex:

Name:Rank:Confirm
Bob:5000:0
James:34:0
Josh:59:1
Alex:48:0
Romney:500:0
Rolf:24:0
Hat:51:0

so when you run the code it will do the following:

Squad:Name1:Name2:Name3:Name4:Name5
1:Bob:Romney:Hat:Alex:James 

(as you can see Josh was excluded and Rolf was too low)

And since Rolf is alone and there are no one else left, he wont be put into a team and will be left unconfirmed…

I’m not really pro at mysql so I was stumped on this and at most was capable of organizing the whole thing by rank and that’s it ._.

edit:
The terrible attempt I had at this:

<?php 
$parse = mysql_query("SELECT MAX(rank) AS rank FROM users AND confirm='0'");
mysql_query("Insert into squad (nameone)values($parse)");
mysql_query("Update squad set confirm = '1' where name = $parse");
?>
  • 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-14T16:22:16+00:00Added an answer on June 14, 2026 at 4:22 pm

    Assuming confirm will have only either 1 or 0.

    CREATE TABLE table2 (id INT PRIMARY KEY AUTO_INCREMENT, name varchar(255));
    CREATE PROCEDURE rank()
    BEGIN
       DECLARE count INT DEFAULT 1;
       WHILE count > 0 DO
          UPDATE table1 SET Confirm=2 WHERE Confirm=0 ORDER BY Rank DESC LIMIT 5; 
          INSERT INTO table2 (SELECT GROUP_CONCAT(Name) FROM table1 WHERE Confirm=2);
          UPDATE table1 SET Confirm=1 WHERE Confirm=2;
          SELECT count(*) FROM table1 WHERE Confirm=0;
       END WHILE;
    END;
    

    Call the procedure rank() when ever you want
    CALL rank();

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

Sidebar

Related Questions

I have a mysql table like this: id employee_number name 1 1 A 2
Ok, so I have two tables in MySQL. One table holds customer information, the
Well I have this code in my Managed C++/Cli in Visual Studio 2008, I
Well currently I have this: <rich:fileUpload addLabel=Agregar clearAllLabel=Quitar todos clearLabel=Quitar deleteLabel=Quitar doneLabel=Completado uploadLabel=Subir archivos
I have this scenario well, i'll let the model explain. public class ScheduleMonthlyPerDayModel {
I have this routine that works well, but it messes up as it counts
I have this linq query that works well (although it may be written better,
I have this code that works well: {livre:empty_name} $.ajax({ url: sent.php, type: post, dataType:
Well this is weird let me describe the scenario I have this mailer define
I have this structure in my html document: <p> <em>You</em> began the evening well,

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.