Advertisement
jeniferfleurant

Mother's club presence

Apr 18th, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MySQL 0.53 KB | None | 0 0
  1. USE caris_db;
  2. SET @start_date="2017-10-01";
  3. SET @end_date="2018-03-31";
  4.  
  5. select left(patient_code,8), count(*) from
  6. (select distinct patient_code #left(patient_code,8), count(*)
  7. from session
  8. left join club_session on club_session.id=id_club_session
  9. left join club on club.id=id_club
  10. #left join club_patient on club_patient.id_club=club.id
  11. left join patient on patient.id=id_patient
  12. where is_present=1 and club_type=1 and left(patient_code,8) is not null and date between @start_date and @end_date
  13. )f
  14. group by left(patient_code,8)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement