För bättre förståelse, se denna länk
SELECT
count(local_doc.providerno) NumberofReferals,
LOCAL_DOC.FULLNAME FULLNAME,
LOCAL_DOC.TELNUMBER TELNUMBER,
LOCAL_DOC.STREET STREET,
LOCAL_DOC.SUBURB SUBURB,
LOCAL_DOC.STATE STATE,
LOCAL_DOC.POSTCODE POSTCODE,
LOCAL_DOC.PROVIDERNO
FROM
LOCAL_DOC,
PATIENT
WHERE
PATIENT.PROVIDERNO = LOCAL_DOC.PROVIDERNO AND PATIENT.REFERALDATE <= sysdate AND PATIENT.REFERALDATE >= ADD_MONTHS(sysdate, -6)
GROUP BY
LOCAL_DOC.FULLNAME ,
LOCAL_DOC.TELNUMBER ,
LOCAL_DOC.STREET ,
LOCAL_DOC.SUBURB ,
LOCAL_DOC.STATE ,
LOCAL_DOC.POSTCODE ,
LOCAL_DOC.PROVIDERNO