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 7609535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T01:11:41+00:00 2026-05-31T01:11:41+00:00

I am trying to build a mysql query to list all column a’s that

  • 0

I am trying to build a mysql query to list all column a’s that have a duplicate column b from a single table. The trick is I have a timestamp on the rows so i need to essentially identify which is the older of the duplicates so i can delete it. Any help would be appreciated.

  • 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-31T01:11:43+00:00Added an answer on May 31, 2026 at 1:11 am

    Just example – this query return duplicate posts, now you just need to execute delete

    id| title     | text_desc          | created 
    -------------------------------------------------------
    1 | The title | description here   |2012-02-21 10:58:58
    2 | The title | description here 1 |2012-02-21 10:58:58
    3 | The title | description here 3 |2012-02-21 10:58:58
    
        select bad_rows.*
         from posts as bad_rows
          inner join (
           select title, MIN(id) as min_id
              from posts
               group by title
                 having count(*) > 1
              ) as good_rows on good_rows.title = bad_rows.title
                and good_rows.min_id <> bad_rows.id;
    

    Here is the return rows

    id| title     | text_desc          | created 
    -------------------------------------------------------
    2 | The title | description here 1 |2012-02-21 10:58:58
    3 | The title | description here 3 |2012-02-21 10:58:58
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to build a MySQL query that uses the rows in a lookup
I'm trying to build a JSON object from a mysql query. The JSON structure
I am trying to Build a simple search that first grabbs 'query' from a
I'm trying to build this query select * from m_orders where year(order_date) = '2010'
I'm trying to build a table that is 5x6 dynamically using PHP. Right now
I have a list of values I am trying to enter into a mysql
I have a mysql table that looks like this: id | uid | title
I'm trying to build a query using php and mysql, $query = select *
I'm using CakePHP/mysql to build my app and I'm trying to get a list
I am trying to build complex mysql query but its returning wrong results... SELECT

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.