SELECT * FROM visit
INNER JOIN visitdiag ON visit.pcucodeperson=visitdiag.pcucode AND visit.visitno=visitdiag.visitno
WHERE visitdiag.diagcode <>'Z%'
AND money1 IS NULL 
AND visit.visitdate BETWEEN '2014-10-01' AND '2015-09-30';