select distinct concat( "", d.demographic_no, "" ) as "Link", d.demographic_no as "Demographic", d.last_name as "Last Name", d.first_name as "First Name", concat(d.date_of_birth, '/', d.month_of_birth, '/', d.year_of_birth) as "Date of Birth", (year(current_date)-year(date_format(concat((d.year_of_birth),'-',(d.month_of_birth),'-',(d.date_of_birth)),'%Y-%m-%d')))-(right(current_date,5)= 65
and d.demographic_no = bh.demographic_no
and bi.ch1_id = bh.id
and datediff(now(), concat(d.year_of_birth, '-', d.month_of_birth, '-', d.date_of_birth))/365 < 71
and datediff(now(), concat(year(bi.service_date), '-', month(bi.service_date), '-', dayofmonth(bi.service_date))) < (365 * {time_since_last_visit})
and d.demographic_no NOT in
(select distinct de.demographic_no
from demographic de, preventions pr
where pr.prevention_type = 'SHINGLES'
and de.demographic_no = pr.demographic_no)
order by d.last_name, d.first_name, d.demographic_no;
select '%' as provider_no, 'All Providers' as provider
union
select provider_no, concat(last_name,',',first_name,'(',provider_no,')') from provider
where status='1'
and provider_type='doctor'
and ohip_no>1
and ohip_no != 123456
order by provider_no;