Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7638633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:13:21+00:00 2026-05-31T08:13:21+00:00

I have two somewhat big (4+ million records) tables with identical structure, and they

  • 0

I have two somewhat big (4+ million records) tables with identical structure, and they have about 300k duplicated rows. I’d like to DELETE the duplicate rows using the DELETE IN syntax.

I’ve already done it using the MERGE statement (available only on 2008 or newer, so I can’t use it since I’m still running 2005), and the DELETE EXISTS, but I’m running into some trouble getting DELETE IN to work.

The problem that I’m having with DELETE IN is that my big table has a composite primary key, meaning I can only identify unique rows using all those columns together.

Is it possible in T-SQL to have multiple expressions as parameters to the IN clause? Something like:

DELETE FROM MyBigTable
WHERE ([Column1], [Column2], [Column3]) IN
    (SELECT [Column1],
            [Column2],
            [Column3]
     FROM MyBigTable
     INTERSECT
     SELECT [Column1],
            [Column2],
            [Column3]
     FROM MyOtherBigTable)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T08:13:22+00:00Added an answer on May 31, 2026 at 8:13 am

    You can just do a JOIN for this:

    DELETE A
    FROM MyBigTable A
    INNER JOIN MyOtherBigTable B
    ON A.Column1 = B.Column1 AND A.Column2 = B.Column2 AND A.Column3 = B.Column3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have two different files somewhat like this: file1.py from file2 import *
Currently I have a service that downloads about 500 records of somewhat complex data,
I have a query that UNION 's two somewhat similar datasets, but they both
I have two tables where I'm trying to select rows where a common field
I have two tables: projects and supplies. Projects have many supplies, like this: has_many
I have two classes generated by LINQ2SQL both from the same table so they
I have two classes that I use to access two different tables in my
This is somewhat related to this question , but not quite. I have two
So my situation is this. I have two tables. A main table where data
I have two console applications to which I would like to add GUIs. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.