• This little snippet returns your expected output:

    declare @t table

    (

    id char(2),

    type int

    )

    insert @t (id, type) values

    ('c1', 0)

    ,('c2', 5)

    ,('c3', 0)

    ,('c4', 0)

    ,('c4', 7)

    ,('c5', 9)

    ,('c6', 4)

    ,('c6', 0)

    ,('c7', 7)

    ,('c8', 0)

    ,('c9', 0)

    select t.id, SUM(type) from @t t

    group by id

    having count(*) = 1 and SUM(type) = 0

    __________________________________________________________________________________________________________
    How to Post to get the most: http://www.sqlservercentral.com/articles/Best+Practices/61537/