User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the MS Access and FileMaker Pro section within the Web Development category of DaniWeb, a massive community of 422,412 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,057 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our MS Access and FileMaker Pro advertiser: Programming Forums
Views: 731 | Replies: 1
Reply
Join Date: May 2007
Posts: 7
Reputation: Kahlia is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Kahlia's Avatar
Kahlia Kahlia is offline Offline
Newbie Poster

Pulling only one medal for a team in Olympic database

  #1  
May 16th, 2008
Hi. Now to start with I'm not asking you to provide me with a solid answer to this, but enough information so that I know where to start looking would be good.

I have a project that I am working on which is an Olympic Database. I have several tables connected with 1:M relationships. The question I am working on now is how to pull from these tables the number of Gold, Silver and Bronze medals won by each country (separately) and the then do a score calculation on them. I have worked out how to calculate the numbers of Gold, Silver and Bronze, but wish to only count the number of medals for a team as 1 (for the country) and at present am pulling in all medals won by the team as individuals.

The Medal table is in format: Medal_id, Medal_Color, Cont_id - where cont_id is the contestant id and relates it to the contestant table.

The Contestant table is in the format: Cont_id, Rep_id, Comp_id, Team_id - where Rep_id is the id of the representative, comp_id the id of the competition and team_id the id of the team.

I want to write the query in SQL that Access 2003 supports and am not sure where to begin with making the count query not count the medals won by a contestant with the same team_id as another contestant.

My other problem / issue is that I would like the count queries that I do to show the medal winners show zeros where they encounter NULL values.

Any help anyone can provide would be greatly appreciated.
Programmer: (noun) An ingenious device for turning coffee into code
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Sep 2006
Location: South Africa
Posts: 15
Reputation: Loony064 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Loony064's Avatar
Loony064 Loony064 is offline Offline
Newbie Poster

Re: Pulling only one medal for a team in Olympic database

  #2  
May 29th, 2008
Hey there

From what i understand, you have a table that stores medals won by various contestants. Various contestants come from various coiuntries. You want to know how many medals in total each country has won.

The first thing i would do is generate a distinct list of those contestants who actually won a medal.

Secondly, i would then determine which countries each of these medal winning contestants belonged to.

Now that you know who has won a medal and what country they belong to, you can look back at the table of "medals won". Look at one country at a time. For each contestant who competes under that country, look at the "medals won" table. In that table, find the corresponding contestant and add the medals won to the total for the country. Repeat the process for each country.

I'm sure there is a more refined process to accomplish this task, but hopefully this will give you a starting point which can help you develop the logical process needed to accomplish this task.

good luck
Laura
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb MS Access and FileMaker Pro Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Other Threads in the MS Access and FileMaker Pro Forum

All times are GMT -4. The time now is 9:31 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC