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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T23:04:16+00:00 2026-06-10T23:04:16+00:00

Was asked the question in regards to a olympic database. For each competitor who

  • 0

Was asked the question in regards to a olympic database.

“For each competitor who was in more than one event, list their given-name, family-name, their number of events, and their best and worst places (and no other data).
List this information in in descending order of their number of events (i.e. most events first),
and (when competitors have the same number of events) then in ascending order of best place,
and (when the same best place) then in ascending order of worst place,
and (when the same worst place) then in ascending order of their family-name.”

I have been trying to write the query to do this, however it does not return the correct count. It stops at a count of 2 and does not return the correct min or max values.
The Tables are:

Competitors Table

Competitornum | Givenname | Familyname | Gender | Dateofbirth | CountryCode | 

Results Table has

Eventid | Competitornum | Place | Lane | Elapsedtime | Note |

Query

SELECT c.Givenname, Familyname, COUNT(r.Competitornum), MIN(r.Place), MAX(r.Place)
FROM Competitors c
JOIN Results r 
ON c.Competitornum=r.Competitornum
Group by c.Givenname, familyname, place
Having Count(r.Competitornum) > 1

This is the query I have come up with so far and am not sure what I have wrong.

  • 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-10T23:04:18+00:00Added an answer on June 10, 2026 at 11:04 pm

    You don’t want to include place in your GROUP BY clause.

    And you will need an ORDER BY clause to meet all the requirements.

    SELECT c.GivenName, c.FamilyName, COUNT(r.CompetitorNum) events,
           MIN(r.Place) best_place, MAX(r.Place) worst_place
      FROM Competitors c
      JOIN Results r ON c.CompetitorNum = r.CompetitorNum
     GROUP BY c.GivenName, c.FamilyName
    HAVING COUNT(r.Competitornum) > 1
     ORDER BY events DESC, best_place ASC, worst_place ASC, c.FamilyName ASC;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just asked this question an hour ago but with regards to IE8
I was asked this question in an interview would appreciate your answers. Regards; Mohammad
The related question has been asked here: CSS3 or jQuery animation with given step
Relating to another question I asked yesterday with regards to logging I was introduced
I previously asked a question with regards to parsing json, since then I found
I have already asked the same question but in regards with MDI Application design.
I know this is a frequently asked question and I havent got a clear
I have tried looking though several of the already asked question about this topic
First, apologies for repeating a variation of an often asked question. However, I am
I asked this question earlier and I got very quick and helpful responses: Linq

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.