Advertisement
jeniferfleurant

CDC

Oct 12th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.35 KB | None | 0 0
  1. select year, count(id_patient) as under_8_weeks, sum(positive) from (select year(date_blood_taken) as year, id_patient,
  2. if(pcr_result=1,1,0) as positive
  3. from testing_specimen where
  4. which_pcr=1 and
  5. timestampdiff(week,date_of_birth,date_blood_taken)<=8 and date_blood_taken
  6. between '2015-01-01' and '2017-06-30'
  7. group by id_patient
  8. )d
  9. group by year
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement