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!

finding the max value from 2 tables

SmileApr 10 2012 — edited Apr 10 2012
Hi i've to find the maximum value of column of 2 tables
The following are the tables
create table tab1(id,cd1,rt1) as 
(select 100 ,'INS' , 'A+' from dual union all
 select 100 ,'INS' ,'A++' from dual)
 
 create table tab2 (id,cd2,rt2) as
 (select 100,'SPU','A-' from dual union all
  select 100,'SPU','A--' from dual)
  
select t1.id, 
case when (t1.cd1='INS' or T2.CD2='SPU')
        then max (t1.rt1 ,t2.rt2) Rtng   -- how to get the max value 
from tab1 t1, tab2 t2
where t1.id=t2.id   
I need to find the maximum RT1 for the CD1
and find the maximum RT2 for the CD2
And the find the maximum of RT1 and RT2

How can i achieve this
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 8 2012
Added on Apr 10 2012
8 comments
329 views