duplicates in a query

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

Guest

How can I stop duplicates from appearing in this query. I have tried
distinct and distinctrow.

SELECT Proposals.ProposalName, Proposal_Info.Date_Opened,
Proposal_Info.Date_Filled,
nz(Int(Proposal_Info.Date_Filled-Proposal_Info.Date_Opened),0) AS
Time_to_Fill,
Workdays(Proposal_Info.Date_Opened,nz(Proposal_Info.Date_Filled,Date())) AS
No_Working_Days, (IIf(IsNull(Proposal_Info.date_filled),'Not Filled','Day(s)
to Fill ')) AS Message, Proposals.Hiring_Manager, Proposals.ProposalID,
Proposals.RecruiterID, Proposal_Info.Position, Proposal_Info.ProposalInfoID
FROM Proposals INNER JOIN Proposal_Info ON Proposals.ProposalID =
Proposal_Info.ProposalID;
 
What are you defining as a duplicate? Each row from Proposals will "repeat"
as many times as it has matching rows in Proposal_Info. If you're worried
about this type of formatting, you should be using a report that includes
grouping levels or a subreport.
 
Go to the database window.
Next Tools, Relationships.
Create a relationship between the ProposalID fields in both tables.
BTW: At least one of these must be the primary key for that table and will
show up in bold in the dialog box.
Click on Referiential Integrity.

If it won't create the relationship with RI, you have bad data which could
include orphans in the child table or a lack of a primary key in the parent
table.

If it does create the relationship, you do not have duplicates. There might
be a lack of a meaningful unique constraint in the parent or child tables
which makes it look like records are duplicating; however, the records are
unique.
 

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