Advertisement
jeniferfleurant

nombre de patient par club

May 30th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.51 KB | None | 0 0
  1. select name as hospital_name, concat(city_code,"/",hospital_code) as hospital_code, sum(club_type=1) as mother, sum(club_type=2) as 9_12, sum(club_type=3) as 13_17, sum(club_type=4) as jeune from (
  2. select club_type, id_hospital from session
  3. left join club_session on club_session.id=session.id_club_session
  4. left join club on club.id=club_session.id_club
  5. where is_present=1 and date between '2016-10-01' and now()
  6. group by id_patient
  7. )v
  8. left join lookup_hospital on lookup_hospital.id=id_hospital
  9. group by id_hospital
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement