Advertisement
jeniferfleurant

Total enfant 0-18 positif

Oct 19th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.68 KB | None | 0 0
  1. USE caris_db;
  2. SET @start_date= "2017-01-01";
  3. select distinct id_patient from testing_result where result=1
  4. union
  5. select id_patient from testing_specimen where pcr_result=1
  6. union
  7. select id_patient from tracking_infant where timestampdiff(year,dob,@start_date)<=18 and timestampdiff(YEAR,dob,@start_date)>=0
  8. and id_patient in
  9. (select * from
  10. (select id_patient from tracking_followup
  11. union
  12. select id_patient from tracking_regime
  13. union
  14. select id_patient from club_patient
  15. union
  16. select id_patient from session
  17. )f
  18. )
  19. and id_patient in (select id from patient where linked_to_id_patient=0)
  20. and
  21. (is_dead=0 or year(death_date)=2017)
  22. and
  23. (is_abandoned=0 or year(abandoned_date)=2017)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement