SELECT NAMES1.EMPLID ,NAMES1.LAST_NAME ,NAMES1.NAME_ROYAL_PREFIX ,CASE WHEN( NAMES1.FIRST_NAME %Concat NAMES1.MIDDLE_NAME) = (' ') THEN ('.') ELSE (NAMES1.FIRST_NAME %Concat ' ' %Concat NAMES1.MIDDLE_NAME) END AS SSR_BR_FST_NMS_NLD FROM PS_NAMES NAMES1 WHERE NAMES1.NAME_TYPE = ( SELECT A.NAME_TYPE FROM PS_SSR_BR_BO_SETUP A ) AND NAMES1.EFFDT = ( SELECT MAX(NAMES2.EFFDT) FROM PS_NAMES NAMES2 WHERE NAMES2.EMPLID = NAMES1.EMPLID AND NAMES2.NAME_TYPE = NAMES1.NAME_TYPE AND NAMES2.EFFDT <= %CurrentDateIn AND NAMES2.EFF_STATUS = 'A')
|