0% found this document useful (0 votes)
27 views2 pages

Query To Create A Spreadsheet For Loading Into Budget

This document contains a long and complex SQL query that selects data from multiple tables related to department budgets. The query retrieves position, department, accounting code, and other key data for a given fiscal year and setid. It uses subqueries and joins to pull the most recent effective records based on dates from several different tables involved in department budgeting and accounting.

Uploaded by

Sita Grandhi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Query To Create A Spreadsheet For Loading Into Budget

This document contains a long and complex SQL query that selects data from multiple tables related to department budgets. The query retrieves position, department, accounting code, and other key data for a given fiscal year and setid. It uses subqueries and joins to pull the most recent effective records based on dates from several different tables involved in department budgeting and accounting.

Uploaded by

Sita Grandhi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

SELECT A.POSITION_NBR, SUBSTR( A.SETID,1,3), A.DEPTID, A.BUDGET_LEVEL_INDC, B.E RNCD, C.FUND_CODE, C.PROJECT_ID, C.CLASS_FLD, C.PROGRAM_CODE, C.DEPTID_CF, B.

DIS T_PCT, ' ' FROM PS_DEPT_BUDGET A, PS_DEPT_SRCH_QRY A1, PS_DEPT_BUDGET_ERN B, PS_DEPT_SRCH _QRY B1, PS_ACCT_CD_TBL C, PS_VALID_COMBO_TBL D WHERE A.SETID = A1.SETID AND A.DEPTID = A1.DEPTID AND A1.OPRID = 'NG000000019' AND B.SETID = B1.SETID AND B.DEPTID = B1.DEPTID AND B1.OPRID = 'NG000000019' AND ( A.EFFDT = (SELECT MAX(A_ED.EFFDT) FROM PS_DEPT_BUDGET A_ED WHERE A.SETID = A_ED.SETID AND A.DEPTID = A_ED.DEPTID AND A.FISCAL_YEAR = A_ED.FISCAL_YEAR AND A.POSITION_POOL_ID = A_ED.POSITION_POOL_ID AND A.SETID_JOBCODE = A_ED.SETID_JOBCODE AND A.JOBCODE = A_ED.JOBCODE AND A.POSITION_NBR = A_ED.POSITION_NBR AND A.EMPLID = A_ED.EMPLID AND A.EMPL_RCD = A_ED.EMPL_RCD AND A_ED.EFFDT <= SYSDATE) AND A.EFFSEQ = (SELECT MAX(A_ES.EFFSEQ) FROM PS_DEPT_BUDGET A_ES WHERE A.SETID = A_ES.SETID AND A.DEPTID = A_ES.DEPTID AND A.FISCAL_YEAR = A_ES.FISCAL_YEAR AND A.POSITION_POOL_ID = A_ES.POSITION_POOL_ID AND A.SETID_JOBCODE = A_ES.SETID_JOBCODE AND A.JOBCODE = A_ES.JOBCODE AND A.POSITION_NBR = A_ES.POSITION_NBR AND A.EMPLID = A_ES.EMPLID AND A.EMPL_RCD = A_ES.EMPL_RCD AND A.EFFDT = A_ES.EFFDT) AND A.SETID = B.SETID AND A.DEPTID = B.DEPTID AND A.FISCAL_YEAR = B.FISCAL_YEAR AND A.POSITION_NBR = B.POSITION_NBR AND A.EFF_STATUS = 'A' AND B.EFFDT = (SELECT MAX(B_ED.EFFDT) FROM PS_DEPT_BUDGET_ERN B_ED WHERE B.SETID = B_ED.SETID AND B.DEPTID = B_ED.DEPTID AND B.FISCAL_YEAR = B_ED.FISCAL_YEAR AND B.POSITION_POOL_ID = B_ED.POSITION_POOL_ID AND B.SETID_JOBCODE = B_ED.SETID_JOBCODE AND B.JOBCODE = B_ED.JOBCODE AND B.POSITION_NBR = B_ED.POSITION_NBR AND B.EMPLID = B_ED.EMPLID AND B.EMPL_RCD = B_ED.EMPL_RCD AND B_ED.EFFDT <= A.EFFDT) AND B.EFFSEQ = (SELECT MAX(B_ES.EFFSEQ) FROM PS_DEPT_BUDGET_ERN B_ES WHERE B.SETID = B_ES.SETID AND B.DEPTID = B_ES.DEPTID AND B.FISCAL_YEAR = B_ES.FISCAL_YEAR AND B.POSITION_POOL_ID = B_ES.POSITION_POOL_ID AND B.SETID_JOBCODE = B_ES.SETID_JOBCODE AND B.JOBCODE = B_ES.JOBCODE

AND B.POSITION_NBR = B_ES.POSITION_NBR AND B.EMPLID = B_ES.EMPLID AND B.EMPL_RCD = B_ES.EMPL_RCD AND B.EFFDT = B_ES.EFFDT) AND B.ACCT_CD = C.ACCT_CD AND A.FISCAL_YEAR = :1 AND A.SETID = :2 AND B.ERNCD = ' ' AND A.BUDGET_LEVEL_INDC IN ('D','P') AND D.EFFDT = (SELECT MAX(D_ED.EFFDT) FROM PS_VALID_COMBO_TBL D_ED WHERE D.SETID = D_ED.SETID AND D.PROCESS_GROUP = D_ED.PROCESS_GROUP AND D.FDM_HASH = D_ED.FDM_HASH AND D_ED.EFFDT <= SYSDATE) AND D.FDM_COMBO_CD = C.ACCT_CD AND D.FDM_HASH = C.FDM_HASH ) ORDER BY 3

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy