Query Tuning

  • I am executing the following query for deleting duplicate records from a table

    Delete from TAB_Ex where not ID=(Select Max(ID) from TAB_Ex T where T.Name=TAB_Ex.Name)

    In the above query TAB_Ex is the table name, ID is Autonumber (Unique id) and Name represents Chat field which is having duplicate entries

    My problem is when i am executing this query, it is taking around 10 minutes to complete the query execution in MS Access

    But when i run the same qury in SQL Server2000 there is no problem.

    The table contains around 12000 records and out of 4000 records are duplicate

    what could be the reason?

  • Using 'not in' doesnt usually optimize well, you might try rewriting it in a different form. Not the best answer I know. Could also do a pass through query.

    Andy

    http://qa.sqlservercentral.com/columnists/awarren/

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

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