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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:14:12+00:00 2026-06-14T20:14:12+00:00

I know that this must be a very basic question, but I’ve not found

  • 0

I know that this must be a very basic question, but I’ve not found an answer.

As the title says, I would like the query the record that holds the max value of a specific column.

I use the following code to achieve that:

SELECT * FROM `table_name` ORDER BY `column_with_specific_max_value` DESC LIMIT 1

I would like to know if there is an other way to achieve the same result (more parsimonious)? I know that SQL has a function MAX(column) but it’s not working the way I want. I tried this:

SELECT * FROM `table_name` WHERE `column_with_specific_max_value`=MAX(`column_with_specific_max_value`)

and this:

SELECT *, MAX(`column_with_specific_max_value`) FROM `table_name`

What happen if the column_with_specific_max_value has 2 rows with the same max value? will it return both rows?

  • 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-14T20:14:13+00:00Added an answer on June 14, 2026 at 8:14 pm

    What about?

    select * from table1
    where score in (select max(score) from table1)
    

    Or even without a max:

    select * from table1
    where score >= all (select score from table1)
    

    Any of those WILL return all rows with the max value. You can play with it here.

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

Sidebar

Related Questions

Now I know this basic question has been asked before, but I must be
I know that this question must have been asked and answered a million times,
I know that this sort of question has been asked here before, but still
I know that this is a newbie question but I am a newbie so
I know that this has already been asked here but the answer (using a
This must be something very basic. I'm not familiar with the syntax, and this
I must admit that I don't really know if this is the right place
I know that this question had already been asked a couple of times before,
I know that this question is asked a lot, I checked all of the
I know that this feature will be deprecated in C++0x, but for me as

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.