Advertisement
bucky_resa

Untitled

Jun 18th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.58 KB | None | 0 0
  1. select distinct g.name
  2.     , g.id
  3.     , x.dcid
  4.     , s.lastfirst
  5.     , s.enroll_status
  6.     , x.enter_date
  7.     , x.code1
  8.     , x.code2
  9.     , x.exit_date
  10.     , x.exitcode
  11.     , x.schoolid
  12.     , x.gradelevel
  13.     , x.studentid
  14. from ps.spenrollments x
  15. join ps.students s
  16.   on (s.dcid = x.dcid)
  17. join ps.terms t on x.enter_date < t.lastday
  18.             and coalesce(x.exit_date, t.firstday) >= t.firstday
  19.             and t.schoolid = s.schoolid
  20.             and t.isyearrec = 1
  21. join ps.gen g
  22.   on (g.id = x.programid and g.cat = 'specprog')
  23. where 1=1
  24.   and t.yearid = 28
  25.   and g.id = 6532
  26.   and s.enroll_status in (0,1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement