select * from Visits; INTO CURSOR test BROWOr if you want to join doctors table (if you select some fields from Doctors table), use LEFT join not INNER.
select *, Doctros.SomeField; FROM Visits; LEFT JOIN Doctors ON Visits.DoctorField = Doctors.MatchingField INTO CURSOR test BROW>>>>I didn''t see the reason of JOIN and with second select. Try this:
>>>>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 >>>