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. 2805438 fiddles created (40816 in the last week).

select * from V$VERSION;
BANNER BANNER_FULL BANNER_LEGACY CON_ID
Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production Version 18.4.0.0.0 Oracle Database 18c Express Edition Release 18.0.0.0.0 - Production 0
 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 cross apply ( select max (a.color) keep (dense_rank first order by prio) color from assessment a, dictionary d where a.record_id = r.id and d.color = a.color ) a
ID COLOR
1 red
 hidden batch(es)