jeniferfleurant

Enfant 0-18 ans sous arv

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