Hi I have a data set where I want to keep specific value when groupby id. For example, I have this data:
create table #test1(
id int,
category1 varchar(20))
;
insert into #test1 values (1,'AAA');
insert into #test1 values (1,'ZZZ');
insert into #test1 values (1,'YYY');
insert into #test1 values (2,'BBB');
insert into #test1 values (2,'ZZZ');
insert into #test1 values (3,'ZZZ');
So in this example, I want to keep AAA and BBB when multiple rows are present for this id.
The result I want to get is:
id category1
1 AAA
2 BBB
3 zzz