add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
create table TableA(Id int, Function varchar(10));
insert into TableA(Id, Function) values
(1, 'code1'), (2, 'code2'), (3, 'code3'), (4, 'code4');
create table TableB(Id int, Function varchar(10));
insert into TableB(Id, Function) values
(1, 'code1'), (2, 'code4'), (3, 'code5');
select a.*,
exists (select 1 from TableB b where b.function = a.function) compare
from TableA a
Id Function compare
1 code1 1
2 code2 0
3 code3 0
4 code4 1
select a.*,
case
when exists (select 1 from TableB b where b.function = a.function) then 'true'
else 'false'
end compare
from TableA a
Id Function compare
1 code1 true
2 code2 false
3 code3 false
4 code4 true