Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- select contacts.id_student,
- (select acadP.id_code
- from upl_academicperiods as acadP
- where contacts.dt_contact_date <= acadP.dt_end_date and acadP.is_active=1
- order by acadP.id_code
- limit 1) as id_academic_period, year(contacts.dt_contact_date) as dt_year, week(contacts.dt_contact_date) as dt_week, contacts.ds_contact_result, count(dt_contact_date) as nm_contacts
- from ret_contacts as contacts
- where contacts.is_active=1
- group by id_student, dt_year, dt_week, ds_contact_result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement