A sample image of this SQL report run in the Database Viewer is shown below:
“Meningitis B” vaccines are any vaccines listed in the patient’s vaccine chart with CVX codes 162-164. They could have been given by the practice or recorded as legacy vaccines from elsewhere.
To highlight and copy the code below to your clipboard, simply click the Copy button.
select a.*, total_menb from ( select patno, fname,lname, birthdat, floor(datediff(month, dateadd(day,-extract(day from birthdat)+1,birthdat), dateadd(day,-extract (day from birthdat)+1,cast('today' as date)) )/12) as age from register where status_pat ='ACTIVE' and patno >99 and lname <> 'TESTPATIENT' ) a left outer join (select patno, count(vacname) as total_menb from vaccine1 where cvxcode in (163,162,164) group by patno) v on a.patno = v.patno where age between 16 and 21