View Full Version : DISTINCTROW


chrisl
12-19-2001, 11:57 AM
Hello.

I am trying to generate a report that identifies a row only once. However, I suspect that I am using the DISTINCTROW incorrectly.

Any clues with this would be greatly appreciated.

SELECT DISTINCTROW EdwaaDepartment.[EDWAAA(1,2,3,4,5,6,7)], MainDepartment.SID, Students.[Last Name], Students.[First Name], StudentStatus.[Work Status], StudentProgramIntersection.[Grad Qtr/Yr], Students.[Phone (Day)], MainDepartment.Boeing, MainDepartment.DescriptionNotes, MainDepartment.Workforce, StudentProgramIntersection.Program
FROM (Students INNER JOIN ((StudentStatus INNER JOIN MainDepartment ON StudentStatus.[Work Status] = MainDepartment.[Work Status]) INNER JOIN EdwaaDepartment ON MainDepartment.DepartmentID = EdwaaDepartment.DepartmentID) ON Students.SID = MainDepartment.SID) INNER JOIN StudentProgramIntersection ON Students.SID = StudentProgramIntersection.SID
WHERE (((EdwaaDepartment.[EDWAAA(1,2,3,4,5,6,7)])=7) AND ((StudentProgramIntersection.[Grad Qtr/Yr])="Sum 2001"));


Thank you.

Pat Hartman
12-19-2001, 05:40 PM
Your query joins 5 tables. I would guess that there is at least one 1-to-many or many-to-many relationship involved. It is these "many" side tables that make it look as though there are duplicates in the recordset. The solution depends on how these tables actually relate.
1. When the tables relate in a hierarchical manner:
A-->B-->C-->D,
the solution is to add group headers at each hierarchical level or set each of the "duplicating" fields to "hide duplicates".
2. When each of the tables is related to a single table but not to each other:
A-->B
A-->C
A-->D,
The solution is to use a subreport for the data from each of the related tables. The above example would show the data from tableA on the main report and there would be 3 subreports. One for each of the other tables.

[This message has been edited by Pat Hartman (edited 12-19-2001).]

raindrop3
12-19-2001, 11:10 PM
I tryed using DISTINCTROW, but it also didn't work. Try using DISTINCT.

Albert