MySQL Forums
Forum List  »  Newbie

need help with query
Posted by: Lori Johnson
Date: June 16, 2005 07:08AM

Hello,
I am having problems eliminating duplicate records from the results of a query. I want the results of my query to list a project only once (by JobNumber), along with that projects corresponding owner, consultants, etc. As my query is now, if a project has two consultants, the JobNumber is appearing in the results twice. Here are my tables:

Table Project
ProjOwnerID
ProjJobNumber (primary)
ProjectName

Table Owner
OwnerID(primary and an auto increment)
OwnerAgency
OwnerName

Table ConsltByProject
ConsltByProjID
ConsltByProjJobNumber

Table Consultant
ConsltID (primary and an auto increment)
ConsltAgency
ConsltName
ConsltTitle

Here’s my query:

SELECT Project.ProjJobNumber, Project.ProjectName, Owner.OwnerAgency, Owner.OwnerName, ConsltByProj.ConsltByProjID, ConsltByProj.ConsltByProjJobNumber, Consultant.ConsltAgency, Consultant.ConsltName, Consultant.ConsltTitle

FROM, Project, Owner ,ConsltByProj, Consultant

WHERE Project.ProjOwnerID=Owner.OwnerAgency AND Project.ProjJobNumber=ConsltByProj.ConsltByProjJobNumber AND ConsltByProj.ConsltByProjID=Consultant.ConsltAgency


Any ideas on how to fix my query so that any duplicate JobNumbers are eliminated? I want a jobnumber to appear only once in the result.

Thanks for your help,
Lori

Options: ReplyQuote


Subject
Written By
Posted
need help with query
June 16, 2005 07:08AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.