i need a query for this requirement urgent plzzzzzzz

  • ff

  • 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

  • thanks its working

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply