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

  • Home
  • SEARCH
  • 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 6880463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:58:38+00:00 2026-05-27T04:58:38+00:00

I have large table (~1,000,000 rows) that may contain duplicates values. the table contain

  • 0

I have large table (~1,000,000 rows) that may contain duplicates values.

the table contain two columns (for example col a, col b) that together represent unique key, ID and last update date.

for example I can have table like:

id | a | b | update

1 | jon | smith | 1/1

2 | don | smith | 2/5

3 | bob | david | 1/1

4 | dan | lewis | 3/1

5 | bob | david | 3/1

As you can see for id 3 and 5 the table contain the same values in both a and b columns.
I would like to delete the rows that contain this kind of duplication , but keep the last updated row.

For this example I will have this table after deletion:
id | a | b | update

1 | jon | smith | 1/1

2 | don | smith | 2/5

4 | dan | lewis | 3/1

5 | bob | davis | 3/1

(id = 3 deleted ,since I already have a=bob and b=davis in row where id=5 and the update in this row is higher then the one in the deleted row)

  • 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-27T04:58:39+00:00Added an answer on May 27, 2026 at 4:58 am
    delete from MyTable
    where exists (
        select 1 from MyTable t2
        where MyTable.a=t2.a and MyTable.b=t2.b and MyTable.upd<t2.upd
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large table (~1M rows now, soon ~10M) that has two ranked
I have a large table (2,000,000 rows) and I'd like to print each record
I have a table with about 100.000 rows that used to look more or
I have a web application that uses a fairly large table (millions of rows,
I have a large DB having > 20,000 rows. I have two tables songs
I have a huge table, which has 3 columns and about 333,000 rows. The
Guys I'm stumped on this one, I have a large table with 100,000 rows
I have a couple of very large tables (over 400,000 rows) that look like
I have a large table (~170 million rows, 2 nvarchar and 7 int columns)
I have quite a large table with 19 000 000 records, and I have

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.