how to query a table, basic question

J

Joe

I know this might be a dumb question but I have 2 tables, 1 has a list of
name & the other is a table for competitions the various players have played
along with the winner and prize. I dont know how to do a query where I can
tell it to pull up how many games were played by each player and another that
shows the number of games that were won by the player. I know it must be very
easy but I am confused! Can anyone help?
 
J

Jerry Whittle

Not a dumb question at all. It gets to the root of database design and usage.

First we need to know the primary key field in the Names table. It's the
field that say this is that person.

Then we need the foriegn key in the Competitions table. It's that field that
has the same data as the primary key field in the Names table. It's used to
join the two tables together.

Also in the Comeptitions table we need to know which field tells if they
won. Is this a number table? Can they win more than once in a record?

So if you can provide the actual table names; their primary and forieign key
field names; and all the other needed field names and what table they are in,
we can construt a query which should pull out the information that you need.
 
J

Joe

Ok, so here is how I have the tables set up...

I have a "Team Table" where I have an ID # (set as the primary key) and the
other fields have their information such as name, last name, address, etc. I
have all participants in this table

The second table I have is the "Game Played" table which has the game date
as the "primary key" then I have a "team ID #1" column and a "Team ID #2"
column where I used the ID# from the team table to define what team played
against who. The last column is the winner column, again using the ID# to
specify the winner.

The third table is the "Game results" table which has the game date (foreign
key), winner, and amount won as the columns for that table.

Please help!
 
T

Tomas C

How does the Team Table relate to the Game Played Table? You say that
you have an ID# set as the primary key field in the Team Table. If that
is the case, each record in your table must have a different ID#. Is
this the case?

It sounds like your Team Table is more correctly called a Player Table.
Do you have Team ID field that could be use to link to the Game Played
table?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top