select de.last_name"Surname",de.first_name"First name", (Year(CURDATE())- de.year_of_birth)"Age", count(drugid)"Number of medications",CONCAT( "(", de.demographic_no, ")" ) "Link" from drugs dr, demographic de where dr.demographic_no = de.demographic_no and de.patient_status = 'AC' and dr.end_date > CURDATE() and de.year_of_birth < (Year(CURDATE())-{age}-1) and de.provider_no = {provider_no} group by de.last_name, de.first_name; select provider_no, concat(last_name,',',first_name,'(',provider_no,')') from provider where status='1' and provider_type='doctor' and ohip_no>1 order by provider_no;