Can 'INSERT INTO' statement handle duplicates?

Database
Enthusiast

Can 'INSERT INTO' statement handle duplicates?

Hi all,

           Can we use UNION ALL when inserting into a table? I know that UNION ALL when used in select statement does not eliminate duplicates. But when used like

INSERT INTO VOL_PO

sel ....

...

group by 1

UNION ALL

sel ...

...

group by 1

will the above code ensure no duplicate records are inserted into VOL_PO? or Should we again do a group by 1?

2 REPLIES
Enthusiast

Re: Can 'INSERT INTO' statement handle duplicates?

Hi,

With Union all and Group by you cant eliminate the duplicate rows. Use Union in place of Union all and no need of Group by that will insert unique records.

Thanks,

Venkat

Teradata Employee

Re: Can 'INSERT INTO' statement handle duplicates?

Which underlying tables are you using .... SET or MULTISET?