finding and deleting duplicates

  • Hi experts,

    When I execute the undermentioned query, I am getting an error message telling me that "No column was specified for column 1 of 'T1'." Could someone please explain what this error message implies.  I am querying on the same table, but I am using two different table aliases. So, why the conflict. In the main query I am using the table alias T, and in the subquery, I am using the table alias t1. The code looks right to me.  What am I missing here? Please help.

    ( SELECT date

    FROM Table1 T

    LEFT OUTER JOIN ( SELECT MIN(date)

    FROM Table1

    GROUP BY Date, PhoneNumber, Amount) T1

    ON T.date = T1.date

    WHERE T1.date IS NULL)

    Thanks,

    Newbie.

  • Following is a good article which match exactly with your requirements

    http://www.sqlservercentral.com/columnists/ccubley/findinganddeletingduplicatedata.asp




    My Blog: http://dineshasanka.spaces.live.com/

  • Change uoyr query

    SELECT [date]

    FROM Table1 T

    LEFT OUTER JOIN ( SELECT MIN([date]) as DT

    FROM Table1

    GROUP BY [date], PhoneNumber, Amount) T1

    ON T.[date] = T1.[DT]

    WHERE T1.[DT] IS NULL




    My Blog: http://dineshasanka.spaces.live.com/

  • Thanks guys for your responses.

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

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