Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pesky SheetID wieved as duplicates due to middle table problem.

Status
Not open for further replies.

PLiNk

IS-IT--Management
Apr 12, 2003
32
NO

Hello, hope someone can help.
I am creating a database for
sheetmusic, and information about the different sheet are stored in the "sheet" table with sheetID as primary key.

Also I have a table called "creator" with all the names of people that has made the music in it.

As a middletable I have a table called SheetCreator with the following fields:
SheetID, CreatorID and Class

where class determines what exactly the creator has done on this particular piece.


To allow people to find out what for instance Andrew Litton has done i am trying to find all the sheetIDs that has Andrew Littons CreatorID number attached in the sheetcreator middletable and list them with a query, but i only want to list each sheetID once!

The problem is that since one can be both the composer, arranger and author (through the class field) behind any given SheetID, any "creator" who prefers to do everything himself, yields three records for each noteID.
My problem is basically that any Creator ID can have the same SheetID three times since the primary key for the middletable "sheetcreator" is all three field in the middletable.

What i need to do is to find a way to remove the second and third (if they exist) records from the list so that each SheetID is only presented once. (I cannot use the uniqueValue property since I depend on presenting the creatorID)
Can I do this in a simpler way?

 
The following would yield one row for each sheetID, creatorID combination.
Code:
SELECT DISTINCT sheetID, creatorID
FROM SheetCreators
Or, given a particular creator
Code:
SELECT DISTINCT sheetID
FROM SheetCreators
WHERE creatorID = ID_for_Andrew_Litton
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top