Can we delete duplicate records from a table in teradata without using intermediate table

后端 未结 3 1947
野趣味
野趣味 2020-12-12 04:48

Can we delete duplicate records from a multiset table in teradata without using intermediate table.

Suppose we have 2 rows with values 1, 2, 3 and 1, 2, 3 in my mu

3条回答
  •  心在旅途
    2020-12-12 05:12

    ---Without creating intermediate table

    delete FROM ORGINAL_TABLE WHERE (COL1, 2) in (select COL1, count() from ORGINAL_TABLE GROUP BY 1 HAVING COUNT() >1 ) and DUPLICATE_BASED_COL >1; -------Delete one row(keep it)

    If you have duplicates and want to delete one row, then we need to use the last line in the sql, if we want to delete both rows than, ignore the condition.

提交回复
热议问题