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
What are the frequently used data types in teradata?
What do you mean by ttu in teradata?
What are the things to be considered while creating secondary index?
What are different table types used in teradata?
Backup Script was blocked then you are unable to archive the data. how do you analyze it and where do you identify ?
if collect stats but it show low confidence why?
What is meant by a Clique?
What do high confidence, low confidence and no confidence mean in explain plan?
What is dimensional modeling?
what is sysdba and sysdbc ? which has high priority ?
In BTEQ, how are the session-mode parameters being set?
Explain parsing engine in teradata?
What are the updated features of teradata?
Explain the advantages of partitioned primary index in a query?
How can bottlenecks be identified?