clear markdown compare help best fiddles feedback dbanow.uk
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2805483 fiddles created (40776 in the last week).

select * from V$VERSION;
BANNER
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
CORE 11.2.0.2.0 Production
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
 hidden batch(es)


with records (id) as ( select 1 from dual), assessment (id, record_id, color) as( select 1, 1, 'red' from dual union all select 2, 1, 'blue ' from dual), dictionary (color, prio) as ( select 'red', 1 from dual union all select 'blue', 2 from dual union all select 'green', 3 from dual) select r.id, a.color from records r join ( select record_id, max (a.color) keep (dense_rank first order by prio) color from assessment a, dictionary d where d.color = a.color group by record_id) a on a.record_id = r.id
ID COLOR
1 red
 hidden batch(es)