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 test
(
id int,
callID int,
callDateTime datetime2,
history varchar(max)
);
insert into test values(1,1,'2021-01-01 10:00:00', 'Information, ID:123');
insert into test values(2,1,'2021-01-01 10:01:00', 'Information, ID:123, ID:123');
insert into test values(3,2,'2021-01-01 11:00:00', 'Information, ID:124');
insert into test values(4,2,'2021-01-01 11:02:00', 'Information 2, ID:124');
insert into test values(5,2,'2021-01-01 11:01:00', 'Information 3, ID:124');
insert into test values(6,3,'2021-01-01 12:00:00', 'Information, ID:125');
6 rows affected
select callid, string_agg(value, ', ')
from (select distinct t.callid, s.value
from test t cross apply
(select trim(s.value) as value
from string_split(t.history, ',') s
) s
) st
group by callid
callid (No column name)
1 ID:123, Information
2 ID:124, Information, Information 2, Information 3
3 ID:125, Information