Skip to content
Advertisement

how to take first value by rank or second in oracle select

I made ranking by using rank() OVER (PARTITION BY ? ORDER BY ? ASC) funtion. It is working fine. But I need to take 1st falue if max rnk of particular application_id value is 1 otherwise 2nd one.

TABLE is like this

My Select is as below:

Result is:

But result should be like this:

Advertisement

Answer

You can use COUNT() analytical function also like this:

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