Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

I need to delete duplicated companies

Posted on 2013-01-14
1
Medium Priority
?
226 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 2000 total points
ID: 38773753
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
In this article, we’ll look at how to deploy ProxySQL.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

916 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