SELECT DISTINCT B.FIELD_SEQUENCE , B.CHARTFIELD FROM PSDBFLDLABL_VW C , PS_LED_GRP_FLD_TBL B , PS_LED_GRP_LED_TBL A WHERE B.CHARTFIELD NOT IN ('BUSINESS_UNIT','ACCOUNT') AND (B.CHARTFIELD = 'ACCOUNT' OR B.CHARTFIELD = 'DEPTID' OR B.CHARTFIELD = 'BUSINESS_UNIT' OR B.CHARTFIELD = 'STATISTICS_CODE' OR EXISTS ( SELECT 'X' FROM PSRECFIELD D WHERE (D.RECNAME ='CFCC1_AN_SBR' OR D.RECNAME = 'CF9A_AK_SBR') AND D.FIELDNAME = B.CHARTFIELD)) AND B.CHARTFIELD = C.FIELDNAME AND A.LEDGER_TYPE_KK > ' ' AND A.SETID = B.SETID AND A.LEDGER_GROUP = B.LEDGER_GROUP
|