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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:11:31+00:00 2026-05-26T17:11:31+00:00

I am using mysql 5.0.51b. I have one table named xyz. xyz table has

  • 0

I am using mysql 5.0.51b.
I have one table named xyz.
xyz table has a columns abc,location,pqr and lmn
Everytime an information is sent to particular location, its entry is done in xyz table.
I want to have the name of the location to which maximum information is sent.

The way i tried:
First of all i count the number of entries sent to each location using count and group by.
Now, the problem is to have the name(s) of the location with maximum values.

I have used temporary solution:
I use order by clause and limit to get the first record that has max values.
But this has one problem
If two locations has same count then above solution will give only one location and the other with same count will not be returned.

I want to solve this problem
Any hint will be very helpful
Thanks in anticipation

  • 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-26T17:11:31+00:00Added an answer on May 26, 2026 at 5:11 pm

    Thank you very much to everyone who has responded to my question and spared time to solve my problem.

    However, i have got the solution:

    SELECT count( * ) AS cnt2, location
    FROM sms
    GROUP BY location
    HAVING cnt2 = (
    SELECT count( * ) AS cnt
    FROM sms
    GROUP BY location
    ORDER BY cnt DESC
    LIMIT 1 );
    

    very important hint on http://lists.mysql.com/mysql/203074

    The inner query gives you the max count and outer query compares each count with max count.

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

Sidebar

Related Questions

Using MySql 5, I have a task where I need to update one table
USING MySQL. I have two tables. Table A, and Table B. Table A has
Using MySQL, when I have a table with (for example) three keys (one primary,
Using MySQL, I have a simple table that logs the IP Address that users
Using MySQL 5 I have a table like this: date (varchar) door (varchar) shift
We're using MySQL and have an ~1.1 million record InnoDB table where the entire
Using MySQL and I have data being loaded into a table every second. I
Using MySQL, I have table Table 1 Id D -------- A 100 A 125
Im using mysql and This is the entry I have in my current table.
Using MySQL I have table of users, a table of matches (Updated with the

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.