• I have gotten a bit further on by nesting a query, but I am not sure I have the distinct right

    SELECT C.first_name"Provider", Count(C.provider_no) "Diabetics with over 1 BP in 12 months"

    FROM

    (Select distinct CONCAT(demo.last_name, ',', demo.first_name) as name, p.provider_no, p.first_name, Count(*)

    FROM measurements m, demographic demo, dxresearch dx, provider p

    WHERE m.type='BP' and m.dateObserved > ((PERIOD_ADD(EXTRACT(YEAR_MONTH FROM CURDATE()),-12)*100)+1) and

    dx.dxresearch_code = '250' and demo.patient_status = 'AC' and demo.roster_status not in ('TE-terminated','transient') and

    demo.provider_no in ('101','102','105','120','121') and dx.status = 'A' and m.demographicNo =demo.demographic_no and

    dx.demographic_no = demo.demographic_no and p.provider_no = demo.provider_no group by name

    HAVING Count(*) > 1 ) as C

    GROUP BY C.provider_no