Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2011
    Posts
    23

    Unanswered: Query returning duplicate records.

    Can anyone help me figure out why this query is returning 13 of the same records, this query is run from a report that creates a letter....it does so fine, but it creates the letter 13 times, so they have to just print page one everytime...would like to get it where it just pulls the record once.

    SELECT NAMES.ID, NAMES.MembershipID, NAMES.Company, NAMES.Section, ADDRESS.Address1, ADDRESS.Address2, ADDRESS.City, ADDRESS.State, ADDRESS.Zip, RELATIONSHIP.Relationship, Membership.[Expiration Date], RELATIONSHIP.Type, RELATIONSHIP.IDNames, ADDRESS.AddressType, ADDRESS.Country, [Enter Section President] AS President, [Enter Section Director] AS Director, [Enter Dear] AS Dear, Mailings.Subscription, NAMES.MainContact
    FROM ((Membership RIGHT JOIN ([NAMES] LEFT JOIN RELATIONSHIP ON NAMES.ID = RELATIONSHIP.ID) ON Membership.ID = NAMES.ID) LEFT JOIN Mailings ON Membership.ID = Mailings.ID) LEFT JOIN ADDRESS ON (Mailings.ID = ADDRESS.ID) AND (Mailings.MailingAddressCode = ADDRESS.Type)
    WHERE (((NAMES.MembershipID)=[Type Rink or RSM ID]) AND ((RELATIONSHIP.Relationship)="Owner/Operator" Or (RELATIONSHIP.Relationship)="Operator" Or (RELATIONSHIP.Relationship)="Manager" Or (RELATIONSHIP.Relationship)="RSM Member") AND ((Mailings.Subscription)="RSB"));

  2. #2
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    Try:
    Code:
    SELECT DISTINCT NAMES.ID, ...
    Have a nice day!

  3. #3
    Join Date
    Aug 2011
    Posts
    23
    Nope, added that in to the code as you showed above and it still returned 13 duplicate records

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •