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!

Get the column value on the basis of priority

1047637Jun 19 2014 — edited Jun 20 2014

Dear Experts,

I have some scenaio where in I need to get  most correct value for a column value .

Example :

I have a table called XX, have two cols in that       AA       BB

AA can have thousands of values, some are

1111

2222

3333

4444

and col BB  can have

40

NULL

95

G6

A1

A2

X

P

31

It is possible that for a value in column AA , I can have all values  or some values in column  BB

I need to get  values in col BB  the basis of prioity 

Priority described  below

40

NULL

95

90

.

.

.

If I get  column B value 40 then  I need to show  40  in col B for respective value in col A, if 40 is not thr but NULL or any other values then show NULL in col B for respective value in col A.

Like this third priority goes to 95   .. rest values are in last prioirty

Select * FROM XX ;

AA          BB
1111         40

1111        NULL

1111        95

1111         X

2222        95

2222       NULL

3333        90

3333         95

Output I want

AA         BB

1111     40

2222     NULL

3333     95

Thanks in advance

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 18 2014
Added on Jun 19 2014
4 comments
870 views