 )
     BEGIN
 
+        -- all immunisations for a patient by NHS number
         select
             i.patient_id, i.effective_date, i.original_code, i.original_term, i.original_code_scheme,
             pr.title as 'Clincian Title', pr.first_name as 'Clinician First Name', pr.last_name as 'Clinician Last Name'
         from
             pcr.immunisation i
-            left join
+        left join
             pcr.practitioner pr on pr.id = i.effective_practitioner_id
-            join
+        join
             pcr.patient p on p.id = i.patient_id
         where
             p.nhs_number = _nhsno;

)
    BEGIN

        select
            a.patient_id, a.effective_date, a.original_code, a.original_term, a.original_code_scheme,
            pr.title as 'Clincian Title', pr.first_name as 'Clinician First Name', pr.last_name as 'Clinician Last Name'
        from
            pcr.allergy a
            left join
            pcr.practitioner pr on pr.id = a.effective_practitioner_id
            join
            pcr.patient p on p.id = a.patient_id
        where
            p.nhs_number = _nhsno;

            a.postcode, a.uprn
        from
            pcr.patient p
        left join
            patient_address pa on pa.patient_id = p.id
        left join
            address a on a.id = pa.address_id
        where
            p.nhs_number = _nhsno;
