User1623084388 posted
Hi everyone,
I have the table below, and I am trying to list all the duplicate codes with distinct val or all val = 0
Code |
Val |
1 |
0 |
1 |
0 |
2 |
0 |
2 |
1 |
3 |
1 |
3 |
1 |
4 |
1 |
4 |
0 |
5 |
0 |
6 |
1 |
declare @Test table (Code varchar(10), Val bit)
Insert into @Test values
('1',0)
,('1',0)
,('2',0)
,('2',1)
,('3',1)
,('3',1)
,('4',1)
,('4',0)
,('5',0)
,('6',1)
The result should be:
Thanks