Relating to same table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a database where I am trying to track our football opponents and the
games they have scouted us. For example, perhaps OpponentD has scouted us
vs OpponentA and OpponentC (but not OpponentB) so I'd like to have a ListBox
on a form where I can select OpponentA and OpponentB to be linked to
OpponentD. And likewise for other opponents.

So here's what I'd like to do:

tblOpponents will essentially contain our schedule of 10 opponents and
contains the following fields:
OpponentID as Autonumber
GamesScouted as Number (which I'd like to relate to OpponentID)
OpponentName as Text
GameDate as Date

I would like to have a one-to-many relationship between OpponentID and
GamesScouted.

Is this possible? Or is there another way to accomplish this same task?
Thanks.

Sterling
 
Hi Sterling,

I believe you will find an example of this in the Northwind sample database,
in the Employees table. A supervisor (Reports To) can have many employees.
This sample uses table lookups, which are considered the creation of the evil
one by most developers (including myself), but you can use a similar SQL
statement in a query to self-reference the table.

Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I have a database where I am trying to track our football opponents and the
games they have scouted us. For example, perhaps OpponentD has scouted us
vs OpponentA and OpponentC (but not OpponentB) so I'd like to have a ListBox
on a form where I can select OpponentA and OpponentB to be linked to
OpponentD. And likewise for other opponents.

So here's what I'd like to do:

tblOpponents will essentially contain our schedule of 10 opponents and
contains the following fields:
OpponentID as Autonumber
GamesScouted as Number (which I'd like to relate to OpponentID)
OpponentName as Text
GameDate as Date

I would like to have a one-to-many relationship between OpponentID and
GamesScouted.

Is this possible? Or is there another way to accomplish this same task?
Thanks.

Sterling
 
Thanks Tom. I looked at the Northwind sample closely and tried to apply it
to my own database. And that seems to have me closer to a solution.
However...

The problem I'm having is in that I need my relationship to be one-to-many
rather than one-to-one (which is how the Employee to Supervisor example is
setup). Keeping the Employee-Supervisor analogy, my situation would be as if
one Employee could "Report To" multiple Supervisors.
 
Hi Sterling,
The problem I'm having is in that I need my relationship to be
one-to-many rather than one-to-one (which is how the Employee
to Supervisor example is setup).

It is not a one-to-one relationship. Three employees report to Steven
Buchanan, and two employees report to Andrew Fuller. Thus, one supervisor can
have many employees. This is a one-to-many relationship.

Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Thanks Tom. I looked at the Northwind sample closely and tried to apply it
to my own database. And that seems to have me closer to a solution.
However...

The problem I'm having is in that I need my relationship to be one-to-many
rather than one-to-one (which is how the Employee to Supervisor example is
setup). Keeping the Employee-Supervisor analogy, my situation would be as if
one Employee could "Report To" multiple Supervisors.
__________________________________________

:

Hi Sterling,

I believe you will find an example of this in the Northwind sample database,
in the Employees table. A supervisor (Reports To) can have many employees.
This sample uses table lookups, which are considered the creation of the evil
one by most developers (including myself), but you can use a similar SQL
statement in a query to self-reference the table.

Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I have a database where I am trying to track our football opponents and the
games they have scouted us. For example, perhaps OpponentD has scouted us
vs OpponentA and OpponentC (but not OpponentB) so I'd like to have a ListBox
on a form where I can select OpponentA and OpponentB to be linked to
OpponentD. And likewise for other opponents.

So here's what I'd like to do:

tblOpponents will essentially contain our schedule of 10 opponents and
contains the following fields:
OpponentID as Autonumber
GamesScouted as Number (which I'd like to relate to OpponentID)
OpponentName as Text
GameDate as Date

I would like to have a one-to-many relationship between OpponentID and
GamesScouted.

Is this possible? Or is there another way to accomplish this same task?
Thanks.

Sterling
 
You are correct, it is a one-to-many relationship. Then I guess I need the
relationship to be a many-to-one. I need one employee to report to several
supervisors. Perhaps I'm missing something very simple in your explanation.
Thanks again for your time on this issue. It is indeed appreciated.
 
Hi Sterling,
Then I guess I need the relationship to be a many-to-one.
A many-to-one relationship *is* the same as a one-to-many relationship.
I need one employee to report to several supervisors.
In this case, you would enter the EmployeeID in each of the Supervisor
records. However, that would only allow you to enter one EmployeeID per
supervisor. It sounds like you really have a many-to-many relationship, which
can be made using two one-to-many relationships joined using a linking table,
ie.:

An employee can have many supervisors (1:M)
and
A supervisor can have many employees (1:M)


You might find something helpful at one of these web sites:

http://www.databaseanswers.org/data_models/index.htm

http://www.rogersaccesslibrary.com/Otherdownload.asp?SampleName='I-A College Football.mdb'

Note: If the above link doesn't work, try starting here:
http://www.rogersaccesslibrary.com/OtherLibraries.asp

and then navigate to Groves, Steven and check out his football sample.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

You are correct, it is a one-to-many relationship. Then I guess I need the
relationship to be a many-to-one. I need one employee to report to several
supervisors. Perhaps I'm missing something very simple in your explanation.
Thanks again for your time on this issue. It is indeed appreciated.
__________________________________________

:

Hi Sterling,
The problem I'm having is in that I need my relationship to be
one-to-many rather than one-to-one (which is how the Employee
to Supervisor example is setup).

It is not a one-to-one relationship. Three employees report to Steven
Buchanan, and two employees report to Andrew Fuller. Thus, one supervisor can
have many employees. This is a one-to-many relationship.

Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

Thanks Tom. I looked at the Northwind sample closely and tried to apply it
to my own database. And that seems to have me closer to a solution.
However...

The problem I'm having is in that I need my relationship to be one-to-many
rather than one-to-one (which is how the Employee to Supervisor example is
setup). Keeping the Employee-Supervisor analogy, my situation would be as if
one Employee could "Report To" multiple Supervisors.
__________________________________________

:

Hi Sterling,

I believe you will find an example of this in the Northwind sample database,
in the Employees table. A supervisor (Reports To) can have many employees.
This sample uses table lookups, which are considered the creation of the evil
one by most developers (including myself), but you can use a similar SQL
statement in a query to self-reference the table.

Tom

http://www.access.qbuilt.com/html/expert_contributors.html
__________________________________________

:

I have a database where I am trying to track our football opponents and the
games they have scouted us. For example, perhaps OpponentD has scouted us
vs OpponentA and OpponentC (but not OpponentB) so I'd like to have a ListBox
on a form where I can select OpponentA and OpponentB to be linked to
OpponentD. And likewise for other opponents.

So here's what I'd like to do:

tblOpponents will essentially contain our schedule of 10 opponents and
contains the following fields:
OpponentID as Autonumber
GamesScouted as Number (which I'd like to relate to OpponentID)
OpponentName as Text
GameDate as Date

I would like to have a one-to-many relationship between OpponentID and
GamesScouted.

Is this possible? Or is there another way to accomplish this same task?
Thanks.

Sterling
 

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

Back
Top