Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. with cca as (
  2. select distinct
  3. s.id as studentid,
  4. ec.name,
  5. yd.abbreviation
  6.  
  7. from students s
  8. inner join cc d on d.studentid = s.id
  9. inner join sections e on d.sectionid = e.id
  10. inner join u_sections_cca ec on e.dcid = ec.sectionsdcid
  11. inner join section_meeting em on e.id = em.sectionid
  12. inner join cycle_day yd on em.cycle_day_letter = yd.letter and em.schoolid = yd.schoolid and em.year_id = yd.year_id
  13.  
  14. where
  15. e.schoolid = :CCASchoolID
  16. and e.termid in (:TermIDs)
  17. )
  18.  
  19. select
  20. s.last_name,
  21. s.first_name,
  22. s.home_room,
  23. ps_customfields.getstudentscf(s.id,'bus_route_pm') as bus_route_pm,
  24. cca.abbreviation,
  25. cca.name,
  26. ac.description
  27.  
  28. from students s
  29. left outer join cca cca on s.id = cca.studentid
  30. left outer join attendance a on s.id = a.studentid and s.schoolid = a.schoolid and a.att_date = trunc(sysdate)
  31. left outer join attendance_code ac on a.attendance_codeid = ac.id
  32.  
  33. where
  34. s.enroll_status = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement