Advertisement
ma39isy

Untitled

Apr 22nd, 2024
1,281
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.     A.*,
  3.     TO_CHAR(A.BIRTHDATE, 'DD/MM/YYYY') AS BIRTHDATE
  4. FROM
  5.     (
  6.     SELECT
  7.         *
  8.     FROM
  9.         STUDENT S
  10.     LEFT JOIN ADDITIONALSTUDENTDATA
  11.             USING(STUDENTID)
  12.     LEFT JOIN STUDYPROGRAM SP ON
  13.         (DECODE(S.CLASSIFICATIONID, '64', '64', S.STUDYPROGRAMID)= SP.STUDYPROGRAMID)
  14.     LEFT JOIN FACULTIES
  15.             USING(FACULTYID)
  16.     LEFT JOIN (
  17.         SELECT
  18.             F.STUDENTID,
  19.             F.FAMILYNAME AS FATHER,
  20.             I.FAMILYNAME AS MOTHER
  21.         FROM
  22.             STUDENTSFAMILY F
  23.         FULL JOIN STUDENTSFAMILY I ON
  24.             (F.STUDENTID = I.STUDENTID)
  25.         WHERE
  26.             F.RELATIONSHIP = 'FATHER'
  27.             AND I.RELATIONSHIP = 'MOTHER')
  28.             USING(STUDENTID)
  29.     LEFT JOIN
  30. (
  31.         SELECT
  32.             STUDENTID,
  33.             VALUE AS CELLPHONE
  34.         FROM
  35.             account
  36.         LEFT JOIN ADDITIONALINFO
  37.                 USING(INFOID)
  38.         WHERE
  39.             INFONAME = 'CELLPHONE')
  40.             USING (STUDENTID)
  41.     LEFT JOIN
  42. (
  43.         SELECT
  44.             STUDENTID,
  45.             VALUE AS ORIGINPHONE
  46.         FROM
  47.             account
  48.         LEFT JOIN ADDITIONALINFO
  49.                 USING(INFOID)
  50.         WHERE
  51.             INFONAME = 'ORIGINPHONE')
  52.             USING (STUDENTID)
  53.     WHERE
  54.         STUDENTID = '6706213100' ) A
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement