SELECT
   T1.triIdTX AS T1_1462,
   T1.triNameTX AS T1_1385,
   T1.triStatusCL AS T1_1463,
   T1.triStatusCLObjId AS T1_1463_OBJID,
   T1.SYS_TYPE1 AS T1_SYS_TYPE1,
   T1.SYS_GUIID AS T1_SYS_GUIID,
   T1.SPEC_ID AS T1_SPEC_ID 
FROM
   M_TRISURVEY T1 
WHERE
   T1.SYS_TYPE1 IN 
   (
      :1,
      :2 
   )
   AND T1.SYS_PROJECTID = :3 
   AND 
   (
      T1.triStatusCL = :4 
   )
   AND T1.SPEC_ID IN 
   (
      SELECT
         ASS_SPEC_ID 
      FROM
         IBS_SPEC_ASSIGNMENTS 
      WHERE
         SPEC_ID IN 
         (
            SELECT
               T1.SPEC_ID AS T1_SPEC_ID 
            FROM
               M_TRIREQUEST T1 
            WHERE
               T1.SYS_TYPE1 IN 
               (
                  :5,
                  :6 
               )
               AND T1.SPEC_ID IN 
               (
                  SELECT
                     ASS_SPEC_ID 
                  FROM
                     IBS_SPEC_ASSIGNMENTS 
                  WHERE
                     SPEC_ID IN 
                     (
                        SELECT
                           T1.SPEC_ID AS T1_SPEC_ID 
                        FROM
                           T_TRIPEOPLE T1 
                        WHERE
                           T1.SPEC_ID IN 
                           (
                              SELECT
                                 ASS_SPEC_ID 
                              FROM
                                 IBS_SPEC_ASSIGNMENTS 
                              WHERE
                                 SPEC_ID IN 
                                 (
                                    :7,
                                    :8 
                                 )
                                 AND ASS_TYPE = :9 
                           )
                           AND T1.SYS_OBJECTID > :10 
                           AND 
                           (
                              T1.SYS_ORGNAMEOBJID IN 
                              (
                                 select
                                    SPEC_ID 
                                 from
                                    T_ORGANIZATION 
                                 where
                                    SYS_OBJECTID > 0 
                                    and 
                                    (
                                       TRIPATHSY = '\Organizations\ISS Providers\ISS Holding' 
                                       or TRIPATHSY like '\Organizations\ISS Providers\ISS Holding\%'
                                    )
                              )
                              OR T1.SYS_ORGNAMEOBJID IN 
                              (
                                 select
                                    SPEC_ID 
                                 from
                                    T_ORGANIZATION 
                                 where
                                    SYS_OBJECTID > 0 
                                    and 
                                    (
                                       TRIPATHSY = '\Organizations\ISS Customers\SODEXO' 
                                       or TRIPATHSY like '\Organizations\ISS Customers\SODEXO\%'
                                    )
                              )
                              OR T1.SYS_ORGNAMEOBJID IN 
                              (
                                 select
                                    SPEC_ID 
                                 from
                                    T_ORGANIZATION 
                                 where
                                    SYS_OBJECTID > 0 
                                    and 
                                    (
                                       TRIPATHSY = '\Organizations\ISS Customers\TELEKOM-D' 
                                       or TRIPATHSY like '\Organizations\ISS Customers\TELEKOM-D\%'
                                    )
                              )
                              OR T1.SYS_ORGNAMEOBJID IN 
                              (
                                 select
                                    SPEC_ID 
                                 from
                                    T_ORGANIZATION 
                                 where
                                    SYS_OBJECTID > 0 
                                    and 
                                    (
                                       TRIPATHSY = '\Organizations\ISS Customers\COMFORTCHARGE' 
                                       or TRIPATHSY like '\Organizations\ISS Customers\COMFORTCHARGE\%'
                                    )
                              )
                              OR T1.SYS_ORGNAMEOBJID IN 
                              (
                                 select
                                    SPEC_ID 
                                 from
                                    T_ORGANIZATION 
                                 where
                                    SYS_OBJECTID > 0 
                                    and 
                                    (
                                       TRIPATHSY = '\Organizations\ISS Customers\DTAG' 
                                       or TRIPATHSY like '\Organizations\ISS Customers\DTAG\%'
                                    )
                              )
                              OR T1.SYS_ORGNAMEOBJID IN 
                              (
                                 select
                                    SPEC_ID 
                                 from
                                    T_ORGANIZATION 
                                 where
                                    SYS_OBJECTID > 0 
                                    and 
                                    (
                                       TRIPATHSY = '\Organizations\ISS Customers\AMPEGA' 
                                       or TRIPATHSY like '\Organizations\ISS Customers\AMPEGA\%'
                                    )
                              )
                              OR T1.SYS_ORGNAMEOBJID IN 
                              (
                                 select
                                    SPEC_ID 
                                 from
                                    T_ORGANIZATION 
                                 where
                                    SYS_OBJECTID > 0 
                                    and 
                                    (
                                       TRIPATHSY = '\Organizations\ISS Customers\PROFOND' 
                                       or TRIPATHSY like '\Organizations\ISS Customers\PROFOND\%'
                                    )
                              )
                              OR T1.SYS_ORGNAMEOBJID IN 
                              (
                                 select
                                    SPEC_ID 
                                 from
                                    T_ORGANIZATION 
                                 where
                                    SYS_OBJECTID > 0 
                                    and 
                                    (
                                       TRIPATHSY = '\Organizations\ISS Customers\MEDIABROADCAST' 
                                       or TRIPATHSY like '\Organizations\ISS Customers\MEDIABROADCAST\%'
                                    )
                              )
                              OR T1.SYS_ORGNAMEOBJID IN 
                              (
                                 select
                                    SPEC_ID 
                                 from
                                    T_ORGANIZATION 
                                 where
                                    SYS_OBJECTID > 0 
                                    and 
                                    (
                                       TRIPATHSY = '\Organizations\ISS Customers\DIVICON' 
                                       or TRIPATHSY like '\Organizations\ISS Customers\DIVICON\%'
                                    )
                              )
                              OR T1.SYS_ORGNAMEOBJID IS NULL
                           )
                           AND 
                           (
                              T1.SYS_GEOGRAPHYNAMEOBJID IN 
                              (
                                 select
                                    SPEC_ID 
                                 from
                                    M_GEOGRAPHY 
                                 where
                                    SYS_OBJECTID > 0 
                                    and 
                                    (
                                       TRIPATHSY = '\Geography\EMEA\Western Europe\Germany' 
                                       or TRIPATHSY like '\Geography\EMEA\Western Europe\Germany\%'
                                    )
                              )
                              OR T1.SYS_GEOGRAPHYNAMEOBJID IS NULL
                           )
                     )
               )
               AND T1.SYS_OBJECTID > :11 
               AND 
               (
                  T1.SYS_ORGNAMEOBJID IN 
                  (
                     select
                        SPEC_ID 
                     from
                        T_ORGANIZATION 
                     where
                        SYS_OBJECTID > 0 
                        and 
                        (
                           TRIPATHSY = '\Organizations\ISS Providers\ISS Holding' 
                           or TRIPATHSY like '\Organizations\ISS Providers\ISS Holding\%'
                        )
                  )
                  OR T1.SYS_ORGNAMEOBJID IN 
                  (
                     select
                        SPEC_ID 
                     from
                        T_ORGANIZATION 
                     where
                        SYS_OBJECTID > 0 
                        and 
                        (
                           TRIPATHSY = '\Organizations\ISS Customers\SODEXO' 
                           or TRIPATHSY like '\Organizations\ISS Customers\SODEXO\%'
                        )
                  )
                  OR T1.SYS_ORGNAMEOBJID IN 
                  (
                     select
                        SPEC_ID 
                     from
                        T_ORGANIZATION 
                     where
                        SYS_OBJECTID > 0 
                        and 
                        (
                           TRIPATHSY = '\Organizations\ISS Customers\TELEKOM-D' 
                           or TRIPATHSY like '\Organizations\ISS Customers\TELEKOM-D\%'
                        )
                  )
                  OR T1.SYS_ORGNAMEOBJID IN 
                  (
                     select
                        SPEC_ID 
                     from
                        T_ORGANIZATION 
                     where
                        SYS_OBJECTID > 0 
                        and 
                        (
                           TRIPATHSY = '\Organizations\ISS Customers\COMFORTCHARGE' 
                           or TRIPATHSY like '\Organizations\ISS Customers\COMFORTCHARGE\%'
                        )
                  )
                  OR T1.SYS_ORGNAMEOBJID IN 
                  (
                     select
                        SPEC_ID 
                     from
                        T_ORGANIZATION 
                     where
                        SYS_OBJECTID > 0 
                        and 
                        (
                           TRIPATHSY = '\Organizations\ISS Customers\DTAG' 
                           or TRIPATHSY like '\Organizations\ISS Customers\DTAG\%'
                        )
                  )
                  OR T1.SYS_ORGNAMEOBJID IN 
                  (
                     select
                        SPEC_ID 
                     from
                        T_ORGANIZATION 
                     where
                        SYS_OBJECTID > 0 
                        and 
                        (
                           TRIPATHSY = '\Organizations\ISS Customers\AMPEGA' 
                           or TRIPATHSY like '\Organizations\ISS Customers\AMPEGA\%'
                        )
                  )
                  OR T1.SYS_ORGNAMEOBJID IN 
                  (
                     select
                        SPEC_ID 
                     from
                        T_ORGANIZATION 
                     where
                        SYS_OBJECTID > 0 
                        and 
                        (
                           TRIPATHSY = '\Organizations\ISS Customers\PROFOND' 
                           or TRIPATHSY like '\Organizations\ISS Customers\PROFOND\%'
                        )
                  )
                  OR T1.SYS_ORGNAMEOBJID IN 
                  (
                     select
                        SPEC_ID 
                     from
                        T_ORGANIZATION 
                     where
                        SYS_OBJECTID > 0 
                        and 
                        (
                           TRIPATHSY = '\Organizations\ISS Customers\MEDIABROADCAST' 
                           or TRIPATHSY like '\Organizations\ISS Customers\MEDIABROADCAST\%'
                        )
                  )
                  OR T1.SYS_ORGNAMEOBJID IN 
                  (
                     select
                        SPEC_ID 
                     from
                        T_ORGANIZATION 
                     where
                        SYS_OBJECTID > 0 
                        and 
                        (
                           TRIPATHSY = '\Organizations\ISS Customers\DIVICON' 
                           or TRIPATHSY like '\Organizations\ISS Customers\DIVICON\%'
                        )
                  )
                  OR T1.SYS_ORGNAMEOBJID IS NULL
               )
               AND 
               (
                  T1.SYS_GEOGRAPHYNAMEOBJID IN 
                  (
                     select
                        SPEC_ID 
                     from
                        M_GEOGRAPHY 
                     where
                        SYS_OBJECTID > 0 
                        and 
                        (
                           TRIPATHSY = '\Geography\EMEA\Western Europe\Germany' 
                           or TRIPATHSY like '\Geography\EMEA\Western Europe\Germany\%'
                        )
                  )
                  OR T1.SYS_GEOGRAPHYNAMEOBJID IS NULL
               )
         )
         AND ASS_TYPE = :12 
   )
   AND T1.SYS_OBJECTID > :13 
   AND 
   (
      T1.SYS_ORGNAMEOBJID IN 
      (
         select
            SPEC_ID 
         from
            T_ORGANIZATION 
         where
            SYS_OBJECTID > 0 
            and 
            (
               TRIPATHSY = '\Organizations\ISS Providers\ISS Holding' 
               or TRIPATHSY like '\Organizations\ISS Providers\ISS Holding\%'
            )
      )
      OR T1.SYS_ORGNAMEOBJID IN 
      (
         select
            SPEC_ID 
         from
            T_ORGANIZATION 
         where
            SYS_OBJECTID > 0 
            and 
            (
               TRIPATHSY = '\Organizations\ISS Customers\SODEXO' 
               or TRIPATHSY like '\Organizations\ISS Customers\SODEXO\%'
            )
      )
      OR T1.SYS_ORGNAMEOBJID IN 
      (
         select
            SPEC_ID 
         from
            T_ORGANIZATION 
         where
            SYS_OBJECTID > 0 
            and 
            (
               TRIPATHSY = '\Organizations\ISS Customers\TELEKOM-D' 
               or TRIPATHSY like '\Organizations\ISS Customers\TELEKOM-D\%'
            )
      )
      OR T1.SYS_ORGNAMEOBJID IN 
      (
         select
            SPEC_ID 
         from
            T_ORGANIZATION 
         where
            SYS_OBJECTID > 0 
            and 
            (
               TRIPATHSY = '\Organizations\ISS Customers\COMFORTCHARGE' 
               or TRIPATHSY like '\Organizations\ISS Customers\COMFORTCHARGE\%'
            )
      )
      OR T1.SYS_ORGNAMEOBJID IN 
      (
         select
            SPEC_ID 
         from
            T_ORGANIZATION 
         where
            SYS_OBJECTID > 0 
            and 
            (
               TRIPATHSY = '\Organizations\ISS Customers\DTAG' 
               or TRIPATHSY like '\Organizations\ISS Customers\DTAG\%'
            )
      )
      OR T1.SYS_ORGNAMEOBJID IN 
      (
         select
            SPEC_ID 
         from
            T_ORGANIZATION 
         where
            SYS_OBJECTID > 0 
            and 
            (
               TRIPATHSY = '\Organizations\ISS Customers\AMPEGA' 
               or TRIPATHSY like '\Organizations\ISS Customers\AMPEGA\%'
            )
      )
      OR T1.SYS_ORGNAMEOBJID IN 
      (
         select
            SPEC_ID 
         from
            T_ORGANIZATION 
         where
            SYS_OBJECTID > 0 
            and 
            (
               TRIPATHSY = '\Organizations\ISS Customers\PROFOND' 
               or TRIPATHSY like '\Organizations\ISS Customers\PROFOND\%'
            )
      )
      OR T1.SYS_ORGNAMEOBJID IN 
      (
         select
            SPEC_ID 
         from
            T_ORGANIZATION 
         where
            SYS_OBJECTID > 0 
            and 
            (
               TRIPATHSY = '\Organizations\ISS Customers\MEDIABROADCAST' 
               or TRIPATHSY like '\Organizations\ISS Customers\MEDIABROADCAST\%'
            )
      )
      OR T1.SYS_ORGNAMEOBJID IN 
      (
         select
            SPEC_ID 
         from
            T_ORGANIZATION 
         where
            SYS_OBJECTID > 0 
            and 
            (
               TRIPATHSY = '\Organizations\ISS Customers\DIVICON' 
               or TRIPATHSY like '\Organizations\ISS Customers\DIVICON\%'
            )
      )
      OR T1.SYS_ORGNAMEOBJID IS NULL
   )
   AND 
   (
      T1.SYS_GEOGRAPHYNAMEOBJID IN 
      (
         select
            SPEC_ID 
         from
            M_GEOGRAPHY 
         where
            SYS_OBJECTID > 0 
            and 
            (
               TRIPATHSY = '\Geography\EMEA\Western Europe\Germany' 
               or TRIPATHSY like '\Geography\EMEA\Western Europe\Germany\%'
            )
      )
      OR T1.SYS_GEOGRAPHYNAMEOBJID IS NULL
   )
ORDER BY
   UPPER(T1.triIdTX)