SELECT
        UserId,
        FirstName,
        MiddleName,
        LastName,
        Gender,
        Email,
        Student,
        Password,
        Major,
        Ethnicity,
        Class,
        Academic_Program,
        LTI_User_ID,
        SSO_UID,
        Act1,
        Act2,
        Act3,
        Act4,
        ActCom,
        Satv,
        Satm,
        SatSum


  FROM (SELECT DISTINCT SPRIDEN_PIDM AS UserID,
        SPRIDEN_FIRST_NAME AS FirstName,
        SPRIDEN_MI AS MiddleName,
        SPRIDEN_LAST_NAME AS LastName,
        SPBPERS_SEX AS Gender,
        HUSTUDENT.CK_EMAIL (SPRIDEN_PIDM) AS Email,
        'student' AS Student,
        'password' AS Password,
        SGBSTDN_MAJR_CODE_1 AS Major,
        SPBPERS_ETHN_CDE AS Ethnicity,
        F_CLASS_CALC_FNC (A.SGBSTDN_PIDM,
                          A.SGBSTDN_LEVL_CODE,
                          SFRSTCR_TERM_CODE) AS Class,
        'ACADEMICPROGRAM' AS Academic_Program,
        'LTIUSERID' AS LTI_User_ID,
        'SSOUID' AS SSO_UID,
        SCHEV.CK_ACT1 (SPRIDEN_PIDM) AS Act1,
        SCHEV.CK_ACT2 (SPRIDEN_PIDM) AS Act2,
        SCHEV.CK_ACT3 (SPRIDEN_PIDM) AS Act3,
        SCHEV.CK_ACT4 (SPRIDEN_PIDM) AS Act4,
        SCHEV.CK_ACT5 (SPRIDEN_PIDM) AS ActCom,
        SCHEV.CK_SATV1 (SPRIDEN_PIDM) AS Satv,
        SCHEV.CK_SATM1 (SPRIDEN_PIDM) AS Satm,
        SCHEV.CK_SATV1 (SPRIDEN_PIDM) + SCHEV.CK_SATM1 (K.SORTEST_PIDM) AS SatSum


  FROM   SPRIDEN,
     SPBPERS,
     SGBSTDN,
         SFRSTCR


  WHERE
               AND SPRIDEN_CHANGE_IND IS NULL
               AND SPRIDEN_PIDM = SPBPERS_PIDM
               AND SPRIDEN_PIDM = SGBSTDN_PIDM
               AND SPRIDEN_PIDM = SFRSTCR_PIDM
               AND SFRSTCR_TERM_CODE = :TERM


               AND :Button_Run_query IS NOT NULL)


  ORDER BY SPRIDEN_LAST_NAME, SPRIDEN_FIRST_NAME
1

There are 1 best solutions below

0
On

I found a couple things I was seeing until I took the above code and put it in Notepad++. As I was splitting it out, I saw that I had WHERE AND, so I fixed that and then I also had to change the order by to LastName and FirstName instead of the actual names out of the file.