jeniferfleurant

# d'enfant de club par site

Oct 12th, 2018
296
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.71 KB | None | 0 0
  1. USE caris_db;
  2. SET @start_date="2018-07-01";
  3. SET @end_date= "2018-09-30";
  4. select left(patient_code,8) as hospital, count(left(patient_code,8)) as total from(
  5. select distinct patient_code, dob from club_patient
  6. left join club_session on club_session.id_club= club_patient.id_club
  7. left join session on session.id_club_session = club_session.id
  8. left join club on club.id = club_session.id_club
  9. left join patient on patient.id = club_patient.id_patient
  10. left join tracking_infant on tracking_infant.id_patient = club_patient.id_patient
  11. where (club_type = 2 or club_type = 3) and is_present=1 and date between @start_date and @end_date and patient_code is not null and linked_to_id_patient=0
  12. )a
  13. group by left(patient_code,8)
Advertisement
Add Comment
Please, Sign In to add comment