I want No Duplication and some extra future.

  • Hi thanks to give the quick response to SSC-Addicted.

    if I have like this:

    Id Name

    ------------------

    1 sqlserver

    2 sqlserver

    3 sqlserver

    4 server

    5 server

    6 sql

    7 sql

    8 sql

    9 sql

    10 abcde

    And I want the output should be

    Id Name

    ------------------

    1 sqlserver

    4 server

    6 sql

    10 abcde

    Means I want the first occurrence names;:-)

    Because I want this for date sorting.

  • Meaning the lowest Id. The order of the rows is not guaranteed.

    select min(id), name

    from table

    group by name



    Ole Kristian Velstadbråten Bangås - Virinco - Facebook - Twitter

    Concatenating Row Values in Transact-SQL[/url]

  • This is very very basic TSQL and looks like homework. Please read the link in my sig which will show you how best to ask questions and post sample data. Having read it, please post some sample data so that folks can begin immediately on your problem.

    Try ROW_NUMBER() OVER(PARTITION BY...ORDER BY). The commonest solutions will require either a derived table or a CTE to filter out the results.


    [font="Arial"]Low-hanging fruit picker and defender of the moggies[/font]

    For better assistance in answering your questions, please read this[/url].


    Understanding and using APPLY, (I)[/url] and (II)[/url] Paul White[/url]

    Hidden RBAR: Triangular Joins[/url] / The "Numbers" or "Tally" Table: What it is and how it replaces a loop[/url] Jeff Moden[/url]

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

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