>>>select Patient_name, Visit_date, MAX(other_field), COUNT(*) AS Cnt from Visits; >>> FROM VISITS >>> GROUP BY VISITS.patient_name, VISITS.visit_date >>> HAVING Cnt>1 >>>>>
>CREATE CURSOR Visits (Patient_name C(50), Visit_Date D, OtherField C(20)) >INSERT INTO Visits VALUES ("Boris", DATE(),"Something") >INSERT INTO Visits VALUES ("Boris", DATE(),"Something else") >INSERT INTO Visits VALUES ("Boris", DATE()+1,"Other") > > >select * from Visits; >where patient_name + DTOS(Visit_Date) in; > (SELECT VISITS.patient_name+DTOS(VISITS.visit_date); > FROM VISITS GROUP BY VISITS.patient_name, VISITS.visit_date; > HAVING count(VISITS.visit_date)>1); >INTO CURSOR test >BROW >** Two records only first two >Without even trying it it seems like in the inner select we need to group only by patient.