Re: T-SQL Duplicate Record Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Plamen Ratchev

    Re: T-SQL Duplicate Record Help

    Here is one way to return all duplicate rows based on the two columns (SQL
    Server 2005):

    ;WITH Dups
    AS
    (SELECT reference_, suppliercode_, value_,
    COUNT(*) OVER(
    PARTITION BY reference_,
    value_) AS cnt
    FROM #TMP)
    SELECT reference_, suppliercode_, value_
    FROM Dups
    WHERE cnt 1;


    HTH,

    Plamen Ratchev


Working...