Hi @PeterP1550
You can try this.
;with T1 as(
select value from table1 cross apply string_split(val,',')
except
select value from table2 cross apply string_split(val,',')
),T2 as(
select STRING_AGG(value,',') as val from T1)
select fname,T2.val from table1,T2;
Output:
;with T1 as(
select value from table2 cross apply string_split(val,',')
except
select value from table1 cross apply string_split(val,',')
),T2 as(
select STRING_AGG(value,',') as val from T1)
select fname,T2.val from table2,T2;
Output:
Best regards,
Percy Tang