SELECT B.SETCNTRLVALUE , A.ACCOUNT , C.TREE_NAME_OTBI , C.TREE_NAME , C.TREE_EFFDT , C.SETID , A.ACCOUNT_DESCR , A.ACCOUNT_TYPE , (CASE WHEN A.ACCT_TYPE_DESCR = ' ' THEN A.ACCOUNT_TYPE ELSE A.ACCT_TYPE_DESCR END) , (CASE WHEN (C.TLVL1_DESC IS NULL OR C.TLVL1_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL1_DESC END) , (CASE WHEN (C.TNODE1_DESC IS NULL OR C.TNODE1_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE1_DESC END) , (CASE WHEN (C.TLVL2_DESC IS NULL OR C.TLVL2_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL2_DESC END) , (CASE WHEN (C.TNODE2_DESC IS NULL OR C.TNODE2_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE2_DESC END) , (CASE WHEN (C.TLVL3_DESC IS NULL OR C.TLVL3_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL3_DESC END) , (CASE WHEN (C.TNODE3_DESC IS NULL OR C.TNODE3_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE3_DESC END) , (CASE WHEN (C.TLVL4_DESC IS NULL OR C.TLVL4_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL4_DESC END) , (CASE WHEN (C.TNODE4_DESC IS NULL OR C.TNODE4_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE4_DESC END) , (CASE WHEN (C.TLVL5_DESC IS NULL OR C.TLVL5_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL5_DESC END) , (CASE WHEN (C.TNODE5_DESC IS NULL OR C.TNODE5_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE5_DESC END) , (CASE WHEN (C.TLVL6_DESC IS NULL OR C.TLVL6_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL6_DESC END) , (CASE WHEN (C.TNODE6_DESC IS NULL OR C.TNODE6_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE6_DESC END) , (CASE WHEN (C.TLVL7_DESC IS NULL OR C.TLVL7_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL7_DESC END) , (CASE WHEN (C.TNODE7_DESC IS NULL OR C.TNODE7_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE7_DESC END) , (CASE WHEN (C.TLVL8_DESC IS NULL OR C.TLVL8_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL8_DESC END) , (CASE WHEN (C.TNODE8_DESC IS NULL OR C.TNODE8_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE8_DESC END) , (CASE WHEN (C.TLVL9_DESC IS NULL OR C.TLVL9_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL9_DESC END) , (CASE WHEN (C.TNODE9_DESC IS NULL OR C.TNODE9_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE9_DESC END) , (CASE WHEN (C.TLVL10_DESC IS NULL OR C.TLVL10_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL10_DESC END) , (CASE WHEN (C.TNODE10_DESC IS NULL OR C.TNODE10_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE10_DESC END) , (CASE WHEN (C.TLVL11_DESC IS NULL OR C.TLVL11_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL11_DESC END) , (CASE WHEN (C.TNODE11_DESC IS NULL OR C.TNODE11_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE11_DESC END) , (CASE WHEN (C.TLVL12_DESC IS NULL OR C.TLVL12_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL12_DESC END) , (CASE WHEN (C.TNODE12_DESC IS NULL OR C.TNODE12_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE12_DESC END) , (CASE WHEN (C.TLVL13_DESC IS NULL OR C.TLVL13_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL13_DESC END) , (CASE WHEN (C.TNODE13_DESC IS NULL OR C.TNODE13_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE13_DESC END) , (CASE WHEN (C.TLVL14_DESC IS NULL OR C.TLVL14_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL14_DESC END) , (CASE WHEN (C.TNODE14_DESC IS NULL OR C.TNODE14_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE14_DESC END) , (CASE WHEN (C.TLVL15_DESC IS NULL OR C.TLVL15_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TLVL15_DESC END) , (CASE WHEN (C.TNODE15_DESC IS NULL OR C.TNODE15_DESC = ' ') THEN A.ACCOUNT_DESCR ELSE C.TNODE15_DESC END) FROM (PS_GL_K_ACCT_VW A LEFT OUTER JOIN PS_GL_KTDEF_ACT_VW C ON A.ACCOUNT = C.ACCOUNT AND(A.SETID = C.SETID OR C.SETID = ' ')) , PS_SET_CNTRL_GROUP B WHERE A.EFFDT = ( SELECT MAX(A_ED.EFFDT) FROM PS_GL_K_ACCT_VW A_ED WHERE A.SETID = A_ED.SETID AND A.ACCOUNT = A_ED.ACCOUNT AND A_ED.EFFDT <= %CurrentDateIn) AND A.SETID = B.SETID AND B.REC_GROUP_ID = 'FS_05'
|