Code uses the same Employee Master table.
The unique record in this table is a combination of Employee_ID and Manager_ID (so two
identical or duplicate rows should not exist). If the table has a unique constraint
or an index, the data clean-up has to be done in a staging table before loading
into the core/main table. A unique constraint violation error will occur if a
constraint or an index is implemented on this table. The query below deletes the older
data and keeps the new or recently sent data. To keep the oldest data,
the third condition in the WHERE clause needs to be reversed (e1.ROWID >
e2.ROWID).
|