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

  • Home
  • SEARCH
  • 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 975221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T03:33:08+00:00 2026-05-16T03:33:08+00:00

I know that question doesn’t make much sense, but here goes: Times Table Authority

  • 0

I know that question doesn’t make much sense, but here goes:

Times Table

Authority           | Time
-------------------------------------
animuson@forums     | 45.6758
132075829385895     | 49.7869
qykumsoy@forums     | 44.45
439854390263565     | 50.761
user@forums         | 44.9
another@auth        | 46.123
bingo@nameo         | 47.4392

So let me explain this. By default, if you have not linked your account to the authority you use, it just stores times as the authority, but if you link your account, it stores your ID number instead. I want the people with ID numbers to have precedence, so they’ll appear over someone who is not linked, but still in order. So for this sample of data, when choosing the top 5, it would output these results:

Authority           | Time
-------------------------------------
qykumsoy@forums     | 44.45
user@forums         | 44.9
animuson@forums     | 45.6758
132075829385895     | 49.7869
439854390263565     | 50.761
-------------------------------------
Ignoring These:
another@auth        | 46.123
bingo@nameo         | 47.4392

Even though those two users had better times, they got knocked off because they’re not linked, the linked accounts got pushed up, but the top 5 still remained in order of their times. It is safe to assume that an ‘@’ symbol being present within the Authority means that it is an unlinked account. It will always appear in an unlinked authority value and a linked account will always be pure numbers. Any ideas on how to do this in one query?

The current query I use which simply selects the top 5 without thinking:

SELECT * FROM `tronner_times` WHERE `mid` = '{$map['mid']}' ORDER BY `time` + 0 LIMIT 5
  • 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-05-16T03:33:09+00:00Added an answer on May 16, 2026 at 3:33 am

    This is the first solution that comes to mind. I’m not sure if it can be optimized further, but you may want to try the following:

    SELECT    dt.authority, dt.time 
    FROM      (
                 SELECT    authority, time 
                 FROM      tronner_times 
                 ORDER BY  INSTR(authority, '@') > 0, time 
                 LIMIT 5
              ) dt
    ORDER BY  dt.time;
    

    Test case:

    CREATE TABLE tronner_times (authority varchar(90), time decimal(8, 4));
    
    INSERT INTO tronner_times VALUES ('animuson@forums', 45.6758);
    INSERT INTO tronner_times VALUES ('132075829385895', 49.7869);
    INSERT INTO tronner_times VALUES ('qykumsoy@forums', 44.45);
    INSERT INTO tronner_times VALUES ('439854390263565', 50.761);
    INSERT INTO tronner_times VALUES ('user@forums', 44.9);
    INSERT INTO tronner_times VALUES ('another@auth', 46.123);
    INSERT INTO tronner_times VALUES ('bingo@nameo ', 47.4392);
    

    Result:

    +-----------------+---------+
    | authority       | time    |
    +-----------------+---------+
    | user@forums     | 44.9000 |
    | another@auth    | 46.1230 |
    | bingo@nameo     | 47.4392 |
    | 132075829385895 | 49.7869 |
    | 439854390263565 | 50.7610 |
    +-----------------+---------+
    5 rows in set (0.00 sec)
    

    We are ordering twice, because the derived table returns the rows without the @ sign at the very top. The expression INSTR(authority, '@') > 0 returns 1 if the @ is present in the authority string, or 0 if it is not. Therefore the result set is first ordered by this expression, and then by the time field, giving rows without the @ a priority (since 0 is sorted before 1). We therefore order the 5 rows from the derived table by the time field to produce the expected final result.

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

Sidebar

Related Questions

I know that such question was has been many times already but I couldn't
I know that that is not a question... erm anyway HERE is the question.
I know that this is a simple question for PHP guys but I don't
Maths101 question - does anyone know how to calculate an ellipse (width/height) that will
A recent question about string literals in .NET caught my eye. I know that
I understand that the question is rather hard to understand, I didn't know how
I don't know if this is too specific a question, if that is possible,
I know that |DataDirectory| will resolve to App_Data in an ASP.NET application but is
I know there's a similar question MPMusicPlayerController stops sending notifications , but the answer
I have a question that doesn't need any specific answer, just a general direction

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.