This?
declare @table table ( id int, sourcecode int, dt datetime)
insert into @table
select 1, null ,'02/06/12'
union all select 2, 2333 ,'02/07/12'
union all select 2, 2345 ,'02/07/12'
union all select 2, null ,'02/07/12'
union all select 3, 1233 ,'02/08/12'
union all select 4, 1233 ,'02/08/12'
select OtTab.id , COUNT(otTab.sourcecode) cn_sourcecode
from @table OtTab
where OtTab.id not in ( select inTab.id
from @table inTab
where inTab.sourcecode is null
)
group by OtTab.id