Skip to Main Content

SQL Developer

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!

Rank function by Sorting function and create custom columns

User_0V525Jul 26 2021

Hello All,
I have a requirement from the below Table
image.pngI need Count of Promoted and Not_promoted Managers with their last 3 phases for each of managers and sort them by ascending order of Manager ID. Result should look like the below one -
image.pngto explain the above one,
example - Manager_ID =10 he got promoted on ( 1st March, 15th March, 23rd March) , Not promoted on (None) , so Under promoted count would be 3 and Not Promoted count would be 0
Under First,Second and Third phase , these three are split accordingly. Similarly others too.
I tried to use Rank over function and tried but I'm unable to get desired output. Can someone please help me with the query to build result set please.

Appreciate your help in Advance
sql query test.xlsx (9.38 KB)

This post has been answered by User_H3J7U on Jul 27 2021
Jump to Answer
Comments
Post Details
Added on Jul 26 2021
2 comments
597 views