Even if you use case when it will still produce duplicates, because ur join condition is what produces the duplicates: the not unique IDs
You have to filter them instead of using case when.
I would have used ur case when as a filter in the where clause, heres a SQL statement for those who want to test (which would have been nice if OP could post something like this next time please)
create table #A (
insert into #A
values ('15674','AUSN ','+14412984775','HT')
create table #B (
insert into #b
left join #B on #A.id = #B.id
where #A.Name in ('AUSN','MAN') and #A.CODE = 'HT'
or #A.Name = 'AUSN' and #A.CODE = 'JK'
I might be missing something, if so correct me
I wanna be the very best
Like no one ever was