The following query is doubling the count of "cases" in the patients table. The "doc" in the members table has only one case but the query is reporting 2!



SELECT members.mfirst , members.mmiddle , members.mlast , , members.member_id , label.descr_lbl , EXTRACT(YEAR
FROM patients.cdate) AS Year , EXTRACT(MONTH FROM patients.cdate) AS yyyymm , COUNT(patients.doc_id)
FROM members
JOIN label ON label.value_lbl = members.demo5
INNER JOIN patients ON patients.doc_id = AND members.mlast ='jewett'
GROUP BY , yyyymm
ORDER BY mlast, patients.cdate

the patients table has 35k records
the members table has 500
the label table just 54