Skip to content
Advertisement

max, over partition by, oracle, take max rownum record

I am trying to pull the maximum rownum in a partition. I am getting the below error message, so I need help to fix my SQL Query. I added in a row number and a row number in a partition in my SQL query. Code is below. I want to take the maximum over this partition and have tried changing the query a few times, but keep getting error messages, so I am getting stuck. I need some help. Please see the below code and error message.

Error message

Advertisement

Answer

This seems very curious. You cannot refer to an alias in the where clause for the select that defines it. So, put the definition in a subquery:

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement