SQL Server Performance

disntict

Discussion in 'ALL SQL SERVER QUESTIONS' started by sivagama, Feb 27, 2014.

  1. sivagama New Member

    hi any body can help me how the distinct can be avoided here

    select distinct number no, ssn id
    into #a
    from b
    where rid>record
  2. AJITH123 Member

    something like this ...

    with cte
    as
    (
    select
    number ,
    row_number()over(partition by number order by number) rw
    from b
    )select
    number , ssn from cte
    where rw=1

Share This Page