Advertisement
ma39isy

Untitled

Jan 23rd, 2024
1,523
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     A.SUBJECTID,
  3.     A.SUBJECTCODE,
  4.     A.STUDYPROGRAMID,
  5.     A.CREDIT,
  6.     A.SUBJECTNAME,
  7.     A.CURICULUMYEAR,
  8.     A.MANDATORYSTATUS,
  9.     A.ADMITSEMESTER,
  10.     A.ADMITSCHOOLYEAR,
  11.     A.SUBJECTTYPE,
  12.     NVL (B.STUDENTID,
  13.     A.STUDENTID) STUDENTID,
  14.     NVL (B.SCHOOLYEAR,
  15.     A.SCHOOLYEAR) SCHOOLYEAR,
  16.     NVL (B.SEMESTER,
  17.     A.SEMESTER) SEMESTER,
  18.     NVL (B.INDEXPOINT,
  19.     A.INDEXPOINT) INDEXPOINT,
  20.     NVL (B.INDEX_CONVERSION,
  21.     A.INDEX_CONVERSION) INDEX_CONVERSION,
  22.     NVL (B.PASS_STATUS,
  23.     A.PASS_STATUS) PASS_STATUS,
  24.     NVL (B.SUBJECTIDOLD,
  25.     A.SUBJECTIDOLD) SUBJECTIDOLD,
  26.     NVL (B.SUBJECTCODEOLD,
  27.     A.SUBJECTCODEOLD) SUBJECTCODEOLD,
  28.     NVL (B.SUBJECTNAMEOLD,
  29.     A.SUBJECTNAMEOLD) SUBJECTNAMEOLD,
  30.     NVL2 ( B.SUBJECTNAMEOLD,
  31.     DECODE (B.SUBJECTID,
  32.     B.SUBJECTIDOLD,
  33.     '',
  34.     'RESULT OF EQUIVALENCE'),
  35.     STATUS) AS STATUS
  36. FROM
  37.     (
  38.     SELECT
  39.         A.SUBJECTID,
  40.         A.SUBJECTCODE,
  41.         A.STUDYPROGRAMID,
  42.         A.CREDIT,
  43.         A.SUBJECTNAME,
  44.         A.CURICULUMYEAR,
  45.         A.MANDATORYSTATUS,
  46.         A.ADMITSEMESTER,
  47.         A.ADMITSCHOOLYEAR,
  48.         A.SUBJECTTYPE,
  49.         B.STUDENTID,
  50.         B.SCHOOLYEAR,
  51.         B.SEMESTER,
  52.         B.INDEXPOINT,
  53.         B.INDEX_CONVERSION,
  54.         B.PASS_STATUS,
  55.         SUBJECTCODEOLD,
  56.         SUBJECTIDOLD,
  57.         STUDYPROGRAMIDOLD,
  58.         SUBJECTNAMEOLD,
  59.         DECODE (B.SUBJECTID,
  60.         SUBJECTIDOLD,
  61.         '',
  62.         'RESULT OF EQUIVALENCE') STATUS
  63.     FROM
  64.         (
  65.         SELECT
  66.             SUBJECTID,
  67.             SUBJECTCODE,
  68.             STUDYPROGRAMID,
  69.             CREDIT,
  70.             SUBJECTNAME,
  71.             CURICULUMYEAR,
  72.             MANDATORYSTATUS,
  73.             ADMITSEMESTER,
  74.             ADMITSCHOOLYEAR,
  75.             SUBJECTTYPE
  76.         FROM
  77.             SUBJECTS
  78.         WHERE
  79.             STUDYPROGRAMID = (
  80.             SELECT
  81.                 STUDYPROGRAMID
  82.             FROM
  83.                 MASTERDATA.STUDENT
  84.             WHERE
  85.                 STUDENTID = '1304192002')
  86.             AND ACTIVESTATUS = 'YA'
  87.             AND MANDATORYSTATUS IS NOT NULL
  88.             AND SUBJECTTYPE = 'TINGKAT 1'
  89.             AND CURICULUMYEAR = (
  90.             SELECT
  91.                 MAX(CURICULUMYEAR)
  92.             FROM
  93.                 CURICULUMYEAR)
  94.             AND SUBJECTNAME NOT LIKE '%AGAMA%'
  95.     UNION
  96.         SELECT
  97.             SUBJECTID,
  98.             SUBJECTCODE,
  99.             STUDYPROGRAMID,
  100.             CREDIT,
  101.             SUBJECTNAME,
  102.             CURICULUMYEAR,
  103.             MANDATORYSTATUS,
  104.             ADMITSEMESTER,
  105.             ADMITSCHOOLYEAR,
  106.             SUBJECTTYPE
  107.         FROM
  108.             SUBJECTS
  109.         WHERE
  110.             STUDYPROGRAMID = (
  111.             SELECT
  112.                 STUDYPROGRAMID
  113.             FROM
  114.                 MASTERDATA.STUDENT
  115.             WHERE
  116.                 STUDENTID = '1304192002')
  117.             AND ACTIVESTATUS = 'YA'
  118.             AND MANDATORYSTATUS IS NOT NULL
  119.             AND SUBJECTTYPE = 'TINGKAT 1'
  120.             AND CURICULUMYEAR = (
  121.             SELECT
  122.                 MAX(CURICULUMYEAR)
  123.             FROM
  124.                 CURICULUMYEAR)
  125.             AND SUBJECTNAME LIKE '%AGAMA%'
  126.             AND SUBJECTNAME LIKE '%' || (
  127.             SELECT
  128.                 RELIGION
  129.             FROM
  130.                 MASTERDATA.ADDITIONALSTUDENTDATA
  131.             WHERE
  132.                 STUDENTID = '1304192002') || '%' ) A
  133.     LEFT JOIN (
  134.         SELECT
  135.             STUDENTID,
  136.             NVL2 (D.SUBJECTID,
  137.             D.SUBJECTID,
  138.             A.SUBJECTID) SUBJECTID,
  139.             NVL2 (D.SUBJECTCODE,
  140.             D.SUBJECTCODE,
  141.             A.SUBJECTCODE) SUBJECTCODE,
  142.             NVL2 (D.STUDYPROGRAMID,
  143.             D.STUDYPROGRAMID,
  144.             A.STUDYPROGRAMID) STUDYPROGRAMID,
  145.             NVL2 (D.SUBJECTNAME,
  146.             D.SUBJECTNAME,
  147.             B.SUBJECTNAME) SUBJECTNAME,
  148.             SCHOOLYEAR,
  149.             SEMESTER,
  150.             INDEXPOINT,
  151.             INDEX_CONVERSION,
  152.             PASS_STATUS,
  153.             NVL2 (D.CURICULUMYEAR,
  154.             D.CURICULUMYEAR,
  155.             B.CURICULUMYEAR) CURICULUMYEAR,
  156.             A.SUBJECTCODE AS SUBJECTCODEOLD,
  157.             A.SUBJECTID AS SUBJECTIDOLD,
  158.             A.STUDYPROGRAMID AS STUDYPROGRAMIDOLD,
  159.             B.SUBJECTNAME AS SUBJECTNAMEOLD
  160.         FROM
  161.             COMPLETECOURSEPOINT A
  162.         JOIN SUBJECTS B ON
  163.             ( A.SUBJECTID = B.SUBJECTID
  164.                 AND A.SUBJECTCODE = B.SUBJECTCODE
  165.                 AND A.STUDYPROGRAMID = B.STUDYPROGRAMID)
  166.         LEFT JOIN (
  167.             SELECT
  168.                 SUBJECTID,
  169.                 SUBJECTCODE,
  170.                 STUDYPROGRAMID,
  171.                 MAX (GROUPID) GROUPID
  172.             FROM
  173.                 SUBJECTGROUPEQUIVALENCY
  174.             GROUP BY
  175.                 SUBJECTID,
  176.                 SUBJECTCODE,
  177.                 STUDYPROGRAMID) C ON
  178.             ( B.SUBJECTID = C.SUBJECTID
  179.                 AND B.SUBJECTCODE = C.SUBJECTCODE
  180.                 AND B.STUDYPROGRAMID = C.STUDYPROGRAMID)
  181.         LEFT JOIN (
  182.             SELECT
  183.                 SUBJECTIDEQUIVALENCE AS SUBJECTID,
  184.                 SUBJECTCODEEQUIVALENCE AS SUBJECTCODE,
  185.                 STUDYPROGRAMIDEQUIVALENCE AS STUDYPROGRAMID,
  186.                 SUBJECTNAME AS SUBJECTNAME,
  187.                 CURICULUMYEAR AS CURICULUMYEAR,
  188.                 GROUPID
  189.             FROM
  190.                 SUBJECTEQUIVALENCES A
  191.             JOIN SUBJECTS B ON
  192.                 (A.SUBJECTIDEQUIVALENCE = B.SUBJECTID) ) D ON
  193.             (C.GROUPID = D.GROUPID)
  194.         WHERE
  195.             STUDENTID = '1304192002'
  196.             AND A.ACTIVESTATUS = 'Y'
  197.             AND A.LATESTSTATUS = 'Y'
  198.     UNION
  199.         SELECT
  200.             STUDENTID,
  201.             A.SUBJECTID,
  202.             A.SUBJECTCODE,
  203.             A.STUDYPROGRAMID,
  204.             B.SUBJECTNAME,
  205.             SCHOOLYEAR,
  206.             SEMESTER,
  207.             INDEXPOINT,
  208.             INDEX_CONVERSION,
  209.             PASS_STATUS,
  210.             B.CURICULUMYEAR,
  211.             A.SUBJECTCODE AS SUBJECTCODEOLD,
  212.             A.SUBJECTID AS SUBJECTIDOLD,
  213.             A.STUDYPROGRAMID AS STUDYPROGRAMIDOLD,
  214.             B.SUBJECTNAME AS SUBJECTNAMEOLD
  215.         FROM
  216.             COMPLETECOURSEPOINT A
  217.         JOIN SUBJECTS B ON
  218.             ( A.SUBJECTID = B.SUBJECTID
  219.                 AND A.SUBJECTCODE = B.SUBJECTCODE
  220.                 AND A.STUDYPROGRAMID = B.STUDYPROGRAMID)
  221.         WHERE
  222.             STUDENTID = '1304192002'
  223.             AND A.ACTIVESTATUS = 'Y'
  224.             AND A.LATESTSTATUS = 'Y' ) B ON
  225.         ( A.SUBJECTID = B.SUBJECTID
  226.             AND A.SUBJECTCODE = B.SUBJECTCODE
  227.             AND A.STUDYPROGRAMID = B.STUDYPROGRAMID)) A
  228. LEFT JOIN (
  229.     SELECT
  230.         A.STUDENTID,
  231.         NVL2 (D.SUBJECTID,
  232.         D.SUBJECTID,
  233.         A.SUBJECTID) SUBJECTID,
  234.         NVL2 (D.SUBJECTCODE,
  235.         D.SUBJECTCODE,
  236.         A.SUBJECTCODE) SUBJECTCODE,
  237.         NVL2 (D.STUDYPROGRAMID,
  238.         D.STUDYPROGRAMID,
  239.         A.STUDYPROGRAMID) STUDYPROGRAMID,
  240.         NVL2 (D.SUBJECTNAME,
  241.         D.SUBJECTNAME,
  242.         B.SUBJECTNAME) SUBJECTNAME,
  243.         SCHOOLYEAR,
  244.         SEMESTER,
  245.         INDEXPOINT,
  246.         INDEX_CONVERSION,
  247.         PASS_STATUS,
  248.         NVL2 (D.CURICULUMYEAR,
  249.         D.CURICULUMYEAR,
  250.         B.CURICULUMYEAR) CURICULUMYEAR,
  251.         A.SUBJECTCODE AS SUBJECTCODEOLD,
  252.         A.SUBJECTID AS SUBJECTIDOLD,
  253.         A.STUDYPROGRAMID AS STUDYPROGRAMIDOLD,
  254.         B.SUBJECTNAME AS SUBJECTNAMEOLD
  255.     FROM
  256.         COMPLETECOURSEPOINT A
  257.     JOIN (
  258.         SELECT
  259.             STUDENTID,
  260.             STUDYPROGRAMID
  261.         FROM
  262.             MASTERDATA.STUDENT
  263.         WHERE
  264.             STUDENTID = '1304192002') E ON
  265.         (A.STUDENTID = E.STUDENTID)
  266.     JOIN SUBJECTS B ON
  267.         ( A.SUBJECTID = B.SUBJECTID
  268.             AND A.SUBJECTCODE = B.SUBJECTCODE
  269.             AND A.STUDYPROGRAMID = B.STUDYPROGRAMID)
  270.     LEFT JOIN (
  271.         SELECT
  272.             SUBJECTID,
  273.             SUBJECTCODE,
  274.             STUDYPROGRAMID,
  275.             MAX (GROUPID) GROUPID
  276.         FROM
  277.             SUBJECTGROUPEQUIVALENCY
  278.         GROUP BY
  279.             SUBJECTID,
  280.             SUBJECTCODE,
  281.             STUDYPROGRAMID) C ON
  282.         (B.SUBJECTCODE = C.SUBJECTCODE
  283.             AND E.STUDYPROGRAMID = C.STUDYPROGRAMID)
  284.     LEFT JOIN (
  285.         SELECT
  286.             SUBJECTIDEQUIVALENCE AS SUBJECTID,
  287.             SUBJECTCODEEQUIVALENCE AS SUBJECTCODE,
  288.             STUDYPROGRAMIDEQUIVALENCE AS STUDYPROGRAMID,
  289.             SUBJECTNAME AS SUBJECTNAME,
  290.             CURICULUMYEAR AS CURICULUMYEAR,
  291.             GROUPID
  292.         FROM
  293.             SUBJECTEQUIVALENCES A
  294.         JOIN SUBJECTS B ON
  295.             (A.SUBJECTIDEQUIVALENCE = B.SUBJECTID) ) D ON
  296.         (C.GROUPID = D.GROUPID)
  297.     WHERE
  298.         A.STUDENTID = '1304192002'
  299.         AND A.ACTIVESTATUS = 'Y'
  300.         AND A.LATESTSTATUS = 'Y'
  301.         AND A.STUDYPROGRAMID != E.STUDYPROGRAMID) B ON
  302.     (A.SUBJECTCODE = B.SUBJECTCODE)
  303. ORDER BY
  304.     STUDENTID,
  305.     SCHOOLYEAR,
  306.     SEMESTER,
  307.     INDEXPOINT
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement