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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T18:55:58+00:00 2026-05-31T18:55:58+00:00

I have a MYSQL-Table which stores scores. Every time a user improves a new

  • 0

I have a MYSQL-Table which stores scores.
Every time a user improves a new entry is inserted into the table.

Example of the table:

| userID |  time  | gameID |
|--------------------------|
|   u1   |    3   |  game1 |
|   u1   |    2   |  game1 |
|   u2   |    3   |  game1 |
|   u3   |    3   |  game1 |
|   u1   |    3   |  game2 |
|   u2   |    1   |  game2 |

I would like to query the table and get a table looking like this.

| gameID |  min_time  | avg_time |
|--------------------------------|
| game1  |      2     |   2.66   |
| game2  |      1     |   2.00   |

I need the minimum time per gameID and the average time which only consists of each users minimum time per game (If a user played game1 three times only the best (shortest) should be used for the average with other users).

Is this possible with a MYSQL query?

  • 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-31T18:55:59+00:00Added an answer on May 31, 2026 at 6:55 pm
    SELECT
        gameID
      , MIN(min_time) AS min_time
      , AVG(min_time) AS avg_time
    FROM
        ( SELECT
              gameID
            , MIN(time) AS min_time
          FROM 
              tableX
          GROUP BY
              gameID
            , userID
        ) AS x
    GROUP BY
        gameID
    
    • 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 field set as time type which stores data in
I have a MySql table called reviews which stores a lot of product reviews,
I have an order table in MySQL database, having a field/column which stores the
I have a table in mysql which stores (among other columns) a bitmask as
I have table a which stores the user id and the ids of his
I have a database table (MySQL 5) which stores file hashes and filenames. I
we have a form which inserts event data into mysql table, this then feeds
I'm using MySql and am pretty new to it. I have a table which
I have a table which stores in each row a meeting with start date/time
I have a huge MySQL table which has its rows encoded in UTF-8 twice.

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.