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 mytable (
ColumnA varchar(20),
ColumnB varchar(20)
);

insert into mytable values
('ABC', '1'),
('oo', 'bb'),
('oo', NULL),
(NULL, 'bb'),
(NULL, NULL),
('BCD', '2'),
('bb', 'oo');



7 rows affected
SELECT *
FROM mytable
WHERE (
columnA <> columnB
AND NOT (columnA = 'bb' and columnB = 'oo'
or columnA = 'oo' and columnB = 'bb')
) OR columnA IS NULL OR columnB IS NULL
ColumnA ColumnB
ABC 1
oo null
null bb
null null
BCD 2