Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2018
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. select contacts.id_student,
  2. (select acadP.id_code
  3. from upl_academicperiods as acadP
  4. where contacts.dt_contact_date <= acadP.dt_end_date and acadP.is_active=1
  5. order by acadP.id_code
  6. 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
  7. from ret_contacts as contacts
  8. where contacts.is_active=1
  9. group by id_student, dt_year, dt_week, ds_contact_result;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement