Returning correct results

popen

Registered User.
Local time
Today, 08:22
Joined
Oct 16, 2000
Messages
37
I have a table of patient details with some that will appear more than once.
I need a query that will only bring back those that appear more than once, and show the results in the relating report.

A normal SELECT statement I have used to filter the results brings back ALL of the patients from the table, which I would expect. But I am stuck on where to only bring those back that appear more than once.

Thanks in advance if you can help me.
 
OK, I'm half way there. I have used the following statement;

SELECT DISTINCT [rptQAB - Temp].PatientID, [rptQAB - Temp].AttendanceID
FROM [rptQAB - Temp]
WHERE ((([rptQAB - Temp].PatientID) In (SELECT [PatientID] FROM [rptQAB - Temp] As Tmp GROUP BY [PatientID] HAVING Count(*) >1 )))
ORDER BY [rptQAB - Temp].PatientID;

Which works OK, but it brings back ALL the duplicates, I only want to see each Patient ID once that has been duplicated.

Thanks in anticipation.
 
Now run a second query to provide unique results.
 

Users who are viewing this thread

Back
Top Bottom