Du vil have insert
. Én metode bruger not exists
:
insert into b (id, key, value_b)
select a.id, 'right', a.value_a
from a
where not exists (select 1
from b
where b.id = a.id and b.key = 'right'
);