Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

selecting max value from the rank function.

817257Oct 8 2012 — edited Oct 8 2012
hi i have the following querry on the user table :

select user_id,email,
rank() over (PARTITION BY Email order by user_id ) AS rank_l
from users_tab;

it gives me the result as follows:
user_id email rank_l
1 a@a.com 1
2 a@a.com 2
3 b@b.com 1
4 b@b.com 2
5 c@c.com 1
6 c@c.com 2
7 c@c.com 3

i need to select the max rank user id only from the result set.
in this case the result that i should get is :
user_id email rank_l
2 a@a.com 2
4 b@b.com 2
7 c@c.com 3


please help ?
This post has been answered by Ravetd on Oct 8 2012
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 5 2012
Added on Oct 8 2012
11 comments
1,727 views