Write a single SQL to delete duplicate records from the a
single table based on a column value. I need only Unique
records at the end of the Query.

Answer Posted / nunna

Query to find duplicates in a table:(Custname, Prod,
Order_amt)

select custname,count(*) from sales1 a where a.rowid > ANY
(select b.rowid from sales1 b where a.custname=b.custname
and a.prod=b.prod and a.order_amt=b.order_amt) group by
custname;

Query to delete duplicates:

delete from sales1 a where a.rowid > ANY (select b.rowid
from sales1 b where a.custname=b.custname and a.prod=b.prod
and a.order_amt=b.order_amt);

Is This Answer Correct ?    7 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is smp and mpp platforms?

531


Highlight the limitations of TPUMP Utility.

608


Explain the new features of teradata?

573


How to Extract data from multiple legacy systems?

576


While creating table my dba has fallback or no fallback in his ddl. What is that?

698






What is the multi-insert?

618


How can bottlenecks be identified?

587


What are the string manipulation operators and functions associated with teradata?

645


how do you manage the production space. what are the proactive methods you can take ?

1483


Difference between multiload and tpump?

623


How would you load a very large file in teradata in general?

569


How is MLOAD Teradata Server restarted after execution?

655


Explain vproc in teradata?

566


How will you solve the problem that occurs during update?

589


What are the frequently used data types in teradata?

606