Categories
- All Categories
- 130 Oracle Analytics News
- 24 Oracle Analytics Videos
- 14.5K Oracle Analytics Forums
- 5.5K Oracle Analytics Idea Labs
- Oracle Analytics User Groups
- 50 Oracle Analytics Trainings
- 8 Oracle Analytics Data Visualizations Challenge
- 4 Oracle Analytics Career
- 8 Oracle Analytics Industry
- Find Partners
- For Partners
SQL Syntax for Max Salary Record?

We would like the most recent salary amount. We used the query below but when we run the SQL we get the error that ORA-00923: FROM keyword not found where expected. Is there something wrong with the SQL for getting the most recent salary? Is there a better SQL to obtain that value?
Select Person_Number, Salary_Amount, StartDateAssignment, Date_From
From
(
SELECT P.Person_Number,
A.Effective_Start_Date AS StartDateAssignment,
SAL.Salary_Amount,
A.Assignment_ID,
AR.ACTION_REASON AS Reason,
SAL.Date_From
, ROW_NUMBER() OVER( Partition By P.Person_Number Order By SAL.Date_From desc, A.Effective_Start_Date desc) As RowNum
FROM Per_All_Assignments_f A
INNER JOIN CMP_SALARY SAL ON SAL.Assignment_ID = A.Assignment_ID
INNER JOIN Per_People_f P ON P.Person_ID = A.Person_ID
INNER JOIN Per_Action_Reasons_TL AR ON AR.ACTION_REASON_ID = SAL.ACTION_REASON_ID
where p.person_number= '4002996'
) Dtable
Where RowNum = 1
Answers
-
ROWNUM is a reserved name. You cannot alias a column ROWNUM. Change it from "as RowNum" to as "r" or something then change the last line to where dtable.r=1.
0 -
Thank you. That got it.
0