Home Forums SQL Server 2008 T-SQL (SS2K8) which is the easy way to Eliminate the duplicates? RE: which is the easy way to Eliminate the duplicates?

  • I'm Sorry, I confudsed the question; however, my target is to return both the values like ID and Code result should be as

    ID Code

    -- -----

    1 111

    3 222

    5 333

    Querry is

    ---------

    declare @T as table(ID int identity, Code varchar(10))

    insert into @T(code) values('111')

    insert into @T(code) values('111')

    insert into @T(code) values('222')

    insert into @T(code) values('222')

    insert into @T(code) values('333')

    select * from @T

    result

    ------

    ID Code

    -- ----

    1 111

    3 222

    5 333