Hi,
I have two table like #table1 and #table2 like below
create table #table1 (tbl1Data nvarchar(100));
create table #table2 (tbl2Data nvarchar(100));
insert into #table1 values ('R07.9,R42');
insert into #table1 values ('E07.9,Z83.3,Z82.49');
insert into #table1 values ('R10.32');
insert into #table1 values ('S00.81XA,S59.802A,S13.9XXA');
insert into #table2 values ('R42');
insert into #table2 values ('Z82.49');
insert into #table2 values ('R42');
insert into #table2 values ('S00.81XA');
insert into #table2 values ('S59.802A');
insert into #table2 values ('E07.9');
select from #table1;
drop table #table1
select from #table2;
drop table #table2
the table1 having value with comma seperated. i need to look this value into
table2 and update any single value into next column
i need the result table took like below
create table #tablewithunique (tbl1Data nvarchar(100), uniquevalue nvarchar(50));
insert into #tablewithunique values ('R07.9,R42','R42');
insert into #tablewithunique values ('E07.9,Z83.3,Z82.49','E07.9');
insert into #tablewithunique values ('R10.32','');
insert into #tablewithunique values ('S00.81XA,S59.802A,S13.9XXA','S00.81XA');
select * from #tablewithunique;
drop table #tablewithunique
What I have tried:
Hi,
I have two table like #table1 and #table2 like below
create table #table1 (tbl1Data nvarchar(100));
create table #table2 (tbl2Data nvarchar(100));
insert into #table1 values ('R07.9,R42');
insert into #table1 values ('E07.9,Z83.3,Z82.49');
insert into #table1 values ('R10.32');
insert into #table1 values ('S00.81XA,S59.802A,S13.9XXA');
insert into #table2 values ('R42');
insert into #table2 values ('Z82.49');
insert into #table2 values ('R42');
insert into #table2 values ('S00.81XA');
insert into #table2 values ('S59.802A');
insert into #table2 values ('E07.9');
select from #table1;
drop table #table1
select from #table2;
drop table #table2
the table1 having value with comma seperated. i need to look this value into
table2 and update any single value into next column
i need the result table took like below
create table #tablewithunique (tbl1Data nvarchar(100), uniquevalue nvarchar(50));
insert into #tablewithunique values ('R07.9,R42','R42');
insert into #tablewithunique values ('E07.9,Z83.3,Z82.49','E07.9');
insert into #tablewithunique values ('R10.32','');
insert into #tablewithunique values ('S00.81XA,S59.802A,S13.9XXA','S00.81XA');
select * from #tablewithunique;
drop table #tablewithunique