Advertisement
compu_85

Focus Query

Oct 24th, 2014
404
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 1.87 KB | None | 0 0
  1. SELECT s.LAST_NAME+', '+s.FIRST_NAME+' '+COALESCE(s.MIDDLE_NAME,' ') AS FULL_NAME,s.LAST_NAME,s.FIRST_NAME,s.MIDDLE_NAME,s.STUDENT_ID,ssm.SCHOOL_ID,ssm.SCHOOL_ID AS LIST_SCHOOL_ID,ssm.GRADE_ID ,
  2.                         sg1.BENCHMARK_ID,
  3.                         sg1.GRADE_TITLE,
  4.                         sg1.COMMENT AS COMMENT_TITLE,
  5.                         ssm.STUDENT_ID,
  6.                         sg1.MARKING_PERIOD_ID,
  7.                         com.COMMENT AS LONGER_COURSE_COMMENTS,
  8.                         sp2.SORT_ORDER,
  9.                         sched.COURSE_PERIOD_ID
  10.  FROM STUDENTS s,STUDENT_ENROLLMENT ssm
  11.         LEFT JOIN       SCHEDULE sched
  12.         ON              sched.STUDENT_ID=ssm.STUDENT_ID
  13.         LEFT JOIN       STUDENT_REPORT_CARD_BENCHMARKS sg1
  14.         ON              (
  15.                             sg1.STUDENT_ID=sched.STUDENT_ID AND
  16.                             sg1.COURSE_PERIOD_ID=sched.COURSE_PERIOD_ID AND
  17.                             CAST(sg1.MARKING_PERIOD_ID AS VARCHAR(10)) IN ('255') AND
  18.                             sg1.SYEAR=sched.SYEAR
  19.                         )
  20.         LEFT JOIN       COURSE_PERIODS rc_cp
  21.         ON              (
  22.                             rc_cp.COURSE_PERIOD_ID=sg1.COURSE_PERIOD_ID AND
  23.                             rc_cp.DOES_GRADES='Y'
  24.                         )
  25.         LEFT JOIN       SCHOOL_PERIODS sp2
  26.         ON              sp2.PERIOD_ID=rc_cp.PERIOD_ID
  27.         LEFT JOIN       STUDENT_REPORT_CARD_COURSE_COMMENTS com
  28.         ON              (
  29.                             com.STUDENT_ID=sched.STUDENT_ID AND
  30.                             com.MARKING_PERIOD_ID=CAST(sg1.MARKING_PERIOD_ID AS VARCHAR(10)) AND
  31.                             com.COURSE_PERIOD_ID=sched.COURSE_PERIOD_ID
  32.                         )
  33. ,SCHEDULE w_ss WHERE ssm.STUDENT_ID=s.STUDENT_ID  AND ssm.SCHOOL_ID='1'  AND ssm.SYEAR='2014' AND ('24-OCT-14' BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL))  AND
  34.                         sched.MARKING_PERIOD_ID IN ('0','252','254','255') AND
  35.                         ('24-OCT-14' BETWEEN sched.START_DATE AND sched.END_DATE OR (sched.END_DATE IS NULL AND '24-OCT-14'>=sched.START_DATE)) AND w_ss.STUDENT_ID=s.STUDENT_ID AND w_ss.SYEAR=ssm.SYEAR AND w_ss.SCHOOL_ID=ssm.SCHOOL_ID AND w_ss.COURSE_PERIOD_ID='7811' AND ('24-OCT-14' BETWEEN w_ss.START_DATE AND w_ss.END_DATE OR w_ss.END_DATE IS NULL) AND s.STUDENT_ID IN ('30297')  ORDER BY s.LAST_NAME,s.FIRST_NAME
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement