Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PL/SQL Query Help

Status
Not open for further replies.
Nov 5, 2003
2
US
Hello!

I know close to nothing about Oracle PL/SQL and am sure that my question is rather trivial, but here's my query:

SELECT
BUSINESS_UNIT, DEPTID, PROJECT_ID, CATEGORY,
To_Char(To_Date(To_Char(ACCOUNTING_PERIOD),'MM'),'Month') || FISCAL_YEAR TIME,
PERIOD_DEPR, CURRENCY_CD
FROM
PS_DEPR_ALL_PD3_VW

I need to be able to do a sum by period_depr and group by currency_cd, then business_unit, then project_id, then time and category.

How can this be done? Please help!!

Thank you,
Katya
 
Hi Katya,
Use following.
Note tha I have commented Deptid from your select clause becuase it does not figure under your Grouping requirement, so it cannot be in Select list.

SELECT
CURRENCY_CD,BUSINESS_UNIT,
---DEPTID,
PROJECT_ID, CATEGORY,
To_Char(To_Date(To_Char(ACCOUNTING_PERIOD),'MM'),'Month') || FISCAL_YEAR TIME,
SUM(PERIOD_DEPR)
FROM
PS_DEPR_ALL_PD3_VW
Group by CURRENCY_CD,BUSINESS_UNIT,PROJECT_ID,To_Char(To_Date(To_Char(ACCOUNTING_PERIOD),'MM'),'Month') || FISCAL_YEAR TIME,CATEGORY

Regards
Himanshu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top