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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Select 'best' row?

ngilbertMay 9 2008 — edited May 12 2008
This might be a pretty simple question but....

If I have a table like this:

Name Col1
A Bad
A Good
A Best
B Good
C Bad
D Bad
D Best

Can someone help me figure out a way to select out the one best row for each name such that I get

Name Col1
A Best
B Good
C Bad
D Best

The idea being that I need one row per name - if a Col1 = 'Best' row isn't found I use Col1 = 'Good' and if that isn't found I use Col1 = 'Bad'

Thanks for any help

Comments

Locked Post
New comments cannot be posted to this locked post.

Post Details

Locked on Jun 9 2008
Added on May 9 2008
6 comments
1,357 views