September 18, 2010 at 8:44 am
Select ((TOT_FCTED_DOL_CUR_3_MTH_AMT/SUM(TOT_FCTED_DOL_CUR_3_MTH_AMT)- (TOT_FCTED_DOL_CUR_12_MTH_AMT/SUM(TOT_FCTED_DOL_CUR_12_MTH_AMT)))) OVER (PARTITION BY TERR_CD, FCLT_IMS_ORG_ID, IMS_RXER_NBR, MKT_SEQ_NBR) AVG_3_MTH_VS_AVG_12_MTH_PCT_CHG,
From A
It's showing an error message like
Error:Incorecct syntax near over.
Please help me
September 18, 2010 at 10:55 am
The OVER () clause only works directly related to a SUM() or any other aggreagtion.
You can't apply it to (more or less) complex calculations.
What you could try is adding the OVER clause to each aggregation:
Select
(TOT_FCTED_DOL_CUR_3_MTH_AMT
/(SUM(TOT_FCTED_DOL_CUR_3_MTH_AMT) OVER (PARTITION BY TERR_CD, FCLT_IMS_ORG_ID, IMS_RXER_NBR, MKT_SEQ_NBR))
- (TOT_FCTED_DOL_CUR_12_MTH_AMT
/(SUM(TOT_FCTED_DOL_CUR_12_MTH_AMT) OVER (PARTITION BY TERR_CD, FCLT_IMS_ORG_ID, IMS_RXER_NBR, MKT_SEQ_NBR))
)
) AS AVG_3_MTH_VS_AVG_12_MTH_PCT_CHG,
Side note:
You might want to consider reformatting queries with rather long statements to improve readability...
September 18, 2010 at 4:18 pm
LutzM (9/18/2010)
Side note:You might want to consider reformatting queries with rather long statements to improve readability...
Since it's all upper case with a pot wad of underscores, I wonder if this is actually an Oracle question. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply