Teradata Question regarding deleting duplicated & Merge statement

Database
Enthusiast

Teradata Question regarding deleting duplicated & Merge statement

Hi, I have a table with duplicate values:

Pa_id Pa_date

01     

1       

02     

2

Here PA ids 01 & 1, 02 & 2 are duplicates. I want a SQL to delete them.

I have written a Merge statement with UPDATE only, no INSERt. It's not working (In Oracle SQL it works fine). Pls suggest.


MERGE INTO dt_dm.party AS tgt

USING dt_dm.party_num_dup AS src

ON tgt.party_id = src.party_id_withzero

WHEN MATCHED THEN UPDATE

SET tgt.party_id = src.party_id_withoutzero;

I am getting error MERGE Failed 3810: Column/Parameter...

1 REPLY
Teradata Employee

Re: Teradata Question regarding deleting duplicated & Merge statement

Teradata does not allow the left-hand side of SET to be explicitly qualified.

Also MERGE does not allow updating a column that is used in the match (ON condition).

Do a joined UPDATE instead.