Hi All, I have a problem i can't solve with this SQL string (below). What it does is a recordset of people (Names and some other info) based on a date .
My problem is that on a specific date there can be multiple values of the same person (InmateID in tblIbmateHearings) and in my result i only want to display a unique value of the person disregarding if there is multiple entries in tblIbmateHearings of that person (InmateID in tblIbmateHearings).
So i cant figure out the WHERE criteria...right now it only checks for the date (in red Below).
How would i add a Unique InmateID check for the table tblInmateHearing?
Maybe i need to change the structure??
My problem is that on a specific date there can be multiple values of the same person (InmateID in tblIbmateHearings) and in my result i only want to display a unique value of the person disregarding if there is multiple entries in tblIbmateHearings of that person (InmateID in tblIbmateHearings).
So i cant figure out the WHERE criteria...right now it only checks for the date (in red Below).
How would i add a Unique InmateID check for the table tblInmateHearing?
Maybe i need to change the structure??
Code:
SELECT DISTINCT tblBranches.Branch, tblBranchEscorts.Branch, tblInmateCases.CaseNo, tblInmatesProfile.InmateID, tblInmatesProfile.LastName, tblInmatesProfile.FirstName, tblInmatesProfile.MiddleName, tblInmatesProfile.CellLocation
FROM tblEscortsName INNER JOIN ((tblBranches INNER JOIN tblBranchEscorts ON tblBranches.BranchID = tblBranchEscorts.Branch) INNER JOIN (tblInmatesProfile INNER JOIN (tblInmateCases INNER JOIN tblInmateHearings ON tblInmateCases.CaseNumberID = tblInmateHearings.CaseNumberID) ON tblInmatesProfile.InmateID = tblInmateCases.InmateID) ON tblBranches.BranchID = tblInmateCases.Branch) ON tblEscortsName.EscortID = tblBranchEscorts.EscortID
WHERE (((tblInmateHearings.Hearings)=[COLOR=Red][B][Forms]![scheduleChooserForm]![dateForSchedule][/B][/COLOR]));
Last edited: