Solved

I need to delete duplicated companies

Posted on 2013-01-14
1
199 Views
Last Modified: 2013-01-14
Hello,

During many imports my customer imported  the same companies many times.

e.g.

Company 1
Company 2
Company 3
Company 1
Company 2
Company 3
Company 2
Company 3
Company 3

I need to delete them so as only the last should remain from each company instance.
I have a timestamp in the table.

The desired result would be
Company 1
Company 2
Company 3

Thank you in advance
0
Comment
Question by:starhu
1 Comment
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 500 total points
Comment Utility
try this


 

DELETE n1 FROM Company_table n1, Company_table n2 WHERE n1.date_field > n2.date_field AND n1.company_name = n2.company_name

refer
http://stackoverflow.com/questions/4685173/delete-all-duplicate-rows-except-for-one-in-mysql

if any problem share the sample data and column names
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now