Delete duplicate data

Source: Internet
Author: User
Tags dname

Delete duplicate data
Delete from cbe_subscriber
Where rowid! = (Select max (rowid)
From cbe_subscriber B
Where a. SUBSCRIBERKEY = B. SUBSCRIBERKEY
And a. APPLYTIME = B. APPLYTIME );
ORACLE deletes duplicate data

I have already tried it. [Line ].
Delete the same row (except for the primary key and other rows with the same attribute value). Let's take an example.
Delete from dept a where a. deptno <>
(
Select min (deptno) from dept t group by (dname, loc)
Having count (*)> 1 and a. dname = t. dname and a. loc = t. loc
);
The primary key of dept is deptno. For rows with the same attribute values (dname, loc), delete the rows repeatedly and leave the row with the smallest deptno value.
---------------------------------------
The primary key of your table is user_id, and the duplicate attribute value is (company_id, fee_date, insure_id,
You can change it to the following:
Delete from t_insure_feed a where a. user_id <>
(
Select min (user_id) from t_insure_feed t group by (company_id, fee_date, insure_id)
Having count (*)> 1 and a. company_id = t. company_id and a. fee_date = t. fee_date and a. insure_id = t. insure_id
);

======================================
The table you created does not have a primary key? Maybe your table does not exist. Try the first 3rd items. If you don't give me a red flag, you won't be playing with you.

3. You can create a new table with no duplicate rows loaded.
Create table mytemp
Select user_id, company_id, fee_date, insure_id/* list all columns */from t_insure_feed group by (user_id, company_id, fee_date, insure_id/* list all columns */);

Query: select * from mytemp;

======================================
1. query duplicate (usr_id) rows:
Select user_id from t_insure_feed group by user_id having count (*)> 1;
2. Delete All duplicate rows! (No more than one)
Delete from t_insure_feed where user_id in (select user_id from t_insure_feed group by user_id having count (*)> 1 );
Tip: rollback can be used for restoration.

How can I use excel to delete duplicate data?

I wonder if you are using an OFFICES2007 or later version? If yes, select all cells-use the condition format-highlight the cell rule-duplicate value-set to: Here select Custom-fill-select a color, and then OK, at this time, repeated options will be filled with the color you set. Next, use EXCEL Data-filtering. If it is version 2007, you will see a "filter by color" option in the drop-down list of filtering options and select the color you just filled in, then, after filtering, you can delete it.

Related Article

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.