clear markdown compare help best fiddles feedback a leap of faith?
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. 1716867 fiddles created (23909 in the last week).

create table t1(id int, name varchar(10), ssn int) create table t1_exclusive(id int)
 hidden batch(es)

insert into t1(id,name,ssn) values (1,'A',111) ,(2,'B',222) ,(3,'C',111) ,(4,'D',333) ,(5,'E',444) ,(6,'F',555) ,(7,'G',222) ,(8,'H',777) ,(9,'I',888) ,(10,'J',999)
10 rows affected
 hidden batch(es)

insert into t1_exclusive(id) values(2);
1 rows affected
 hidden batch(es)

declare @x_ssn int = null select,, t1.ssn from t1 left join t1_exclusive on = where (t1.ssn = @x_ssn or @x_ssn is null)
id name ssn
1 A 111
2 B 222
3 C 111
4 D 333
5 E 444
6 F 555
7 G 222
8 H 777
9 I 888
10 J 999
 hidden batch(es)