Subject Select distinct where values change
Author mikcaau
I have been asked to produce a result set to answer the following,

Within the period (12-24 months) count the unique patients who have
attended the practice and show the answer grouped by
age (at consultation) (and period of report will change)
gender (which probably won't change)
locality (which will probably change)
program (which will change)

only the first consultation for each patient is counted.

Do I need to use co-related subqueries so that I count each patient
only once?

and then retrieve from that sub-query just that information
Age_At_Consult, Locality (at time of consult) and Program (again at
time of consult)

Mick