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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T00:05:38+00:00 2026-06-17T00:05:38+00:00

OK. I have database which is made from data used in TRAVIAN game. I

  • 0

OK. I have database which is made from data used in TRAVIAN game. I have 200000 rows, so I want to reduce it for Excel analysis.

x   y   village player alliance population  date
27 -41  h1      h       S       35          2009-12-23
27 -41  h1      h       S       56          2009-12-24
27 -41  h1      h       S       60          2009-12-25
27 -41  h1      h       S       89          2009-12-26

These are just some of the important atributes in table. There is a lot of other entries for each village every time when player is logged into system. So you can see the population growing per each village. I just want to write an sql statement which returns me only entry where maximum population of the village is. (for each village of course).

I wrote something like this

SELECT * 
FROM x_world
GROUP BY village
HAVING population = max(population)

In theory i want to loop over each village and search for its biggest population entry and take just that one. I want to do this for each village. This is how i will also a total number of villages.

  • 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-17T00:05:39+00:00Added an answer on June 17, 2026 at 12:05 am

    Try this query using joins. It is much faster then dependant subqueries.

    SELECT 
        * 
    FROM x_world as xr
    INNER JOIN (
            SELECT 
                    x,
                    MAX(population)
            FROM x_world as xr
            GROUP BY x 
    ) as xt ON xt.x = xr.x
    GROUP BY village
    

    Demo

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

Sidebar

Related Questions

I have a database from which I want to query and display only that
I have a datagrid view which shows table data from a database Environment: -
I have made a program in Java which is used to collect medical data
I have made a dump of my database in which one table is pretty
i have a windows application made in VB.NET which maintains a database, and i
I have a database which I regularly need to import large amounts of data
I have a database which contains picture data stored as a binary blob. The
I have some stored proc.s that get data from DB. I made some data
I have made a website in which the users can select a value from
I have a form which is used as an interface for CRUD on database

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.