Check duplicate names in SQL server table

Aug 28 2017 10:55 AM
Hi all,
i have below table like this.
id name class
1     A     null
2     B     null
3     c     null
4     d     null
1     A     9
3     c      9
how to check data with bit value is exist or not. i need below output.
i tried this... but not working
SELECT Id,name,class
(case when isnull(class,123)=123 then 0 else 1 end) as exist
FROM test_Table.
 
i need below output 
id name class exist
1    A     null     0
2    B     null     0
3     c     null    0
4     d     null    0
1     A     9       1
3    c        9       1
regards
Kishore

Answers (2)