SQL statement method to delete data table repeating fields

Source: Internet
Author: User
Everyone may encounter field duplication, many people on the web looking for methods, but also give some methods, but some methods are misleading, Optimus write the following methods to facilitate the use of everyone

1. Filter the duplicate fields through group by and create a temp table tmp

CREATE TABLE tmp as SELECT MAX (ID) as col1 from WWW Group by DFDFD;

2. To filter out column col1 that are not on the temporary table from a Deduplication object by using the not in condition to perform a delete operation of not in


3. Delete temporary tables

DROP table tmp;

Welcome to join the PHP technology and Workplace Exchange Group: 383730534

SQL statement method to delete data table repeating fields

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.