I have a query that uses 3 tables - Units, Applicants, and Guarantors. Each Unit is unique but could be assigned to any number of applicants. The guarantors are then tied directly to the applicant. When I run the query, if there are multiple applicants for one unit, the guarantors are appearing multiple times in the query. Any advise would be greatly appreciated. :banghead: Below is the SQL behind the query.
SELECT Units.ID, Units.Property, Applicants.Property, Applicants.Tenant_Code, "" AS Ext_Ref_Tenant_Id, Guarantors.Roommate_PhoneNumber1, "" AS Roommate_PhoneNumber2, "" AS Roommate_PhoneNumber3, "" AS Roommate_PhoneNumber4, Guarantors.Roommate_UserDefined0, Guarantors.Roommate_UserDefined1, "" AS Roommate_UserDefined2, Guarantors.Roommate_UserDefined3, Guarantors.Roommate_UserDefined4, Guarantors.Roommate_UserDefined5, Guarantors.Roommate_UserDefined6, "" AS Roommate_UserDefined7, "" AS Roommate_UserDefined8, "" AS Roommate_UserDefined9, "" AS Roommate_SSN, Units.Property_Code, "" AS Ref_Property_ID, Units.Unit_Code, "" AS Ref_Unit_Id, "" AS Ext_Ref_Roommate_Id, "" AS Roommate_Salutation, Guarantors.[First Name], Guarantors.[Last Name], Guarantors.Roommate_Email, "" AS Roommate_ALTEmail, "" AS Roommate_MoveIn, "" AS Roommate_MoveOut, "" AS Occupant_Type, "-1" AS Roommate_Occupant, "" AS Roommate_ACHOptOut, "Guarantor" AS Roommate_Relationship, "" AS Roommate_Notes, "" AS Roommate_Code, Guarantors.[Uploaded to Yardi], Units.[Full Renewal], Applicants.[Lease Signed]
FROM (Units INNER JOIN Guarantors ON Units.ID = Guarantors.Property) INNER JOIN Applicants ON Units.ID = Applicants.Property
WHERE (((Guarantors.[Uploaded to Yardi])=No) AND ((Units.[Full Renewal])=No) AND ((Applicants.[Lease Signed])=Yes));
SELECT Units.ID, Units.Property, Applicants.Property, Applicants.Tenant_Code, "" AS Ext_Ref_Tenant_Id, Guarantors.Roommate_PhoneNumber1, "" AS Roommate_PhoneNumber2, "" AS Roommate_PhoneNumber3, "" AS Roommate_PhoneNumber4, Guarantors.Roommate_UserDefined0, Guarantors.Roommate_UserDefined1, "" AS Roommate_UserDefined2, Guarantors.Roommate_UserDefined3, Guarantors.Roommate_UserDefined4, Guarantors.Roommate_UserDefined5, Guarantors.Roommate_UserDefined6, "" AS Roommate_UserDefined7, "" AS Roommate_UserDefined8, "" AS Roommate_UserDefined9, "" AS Roommate_SSN, Units.Property_Code, "" AS Ref_Property_ID, Units.Unit_Code, "" AS Ref_Unit_Id, "" AS Ext_Ref_Roommate_Id, "" AS Roommate_Salutation, Guarantors.[First Name], Guarantors.[Last Name], Guarantors.Roommate_Email, "" AS Roommate_ALTEmail, "" AS Roommate_MoveIn, "" AS Roommate_MoveOut, "" AS Occupant_Type, "-1" AS Roommate_Occupant, "" AS Roommate_ACHOptOut, "Guarantor" AS Roommate_Relationship, "" AS Roommate_Notes, "" AS Roommate_Code, Guarantors.[Uploaded to Yardi], Units.[Full Renewal], Applicants.[Lease Signed]
FROM (Units INNER JOIN Guarantors ON Units.ID = Guarantors.Property) INNER JOIN Applicants ON Units.ID = Applicants.Property
WHERE (((Guarantors.[Uploaded to Yardi])=No) AND ((Units.[Full Renewal])=No) AND ((Applicants.[Lease Signed])=Yes));