cancel
Showing results forย 
Search instead forย 
Did you mean:ย 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

How to prevent duplicate records when using MERGE INTO?

dataumer
New Contributor

hello guys

What is the best way to handle a source dataset that contains multiple records for the same business key before performing a MERGE into a Delta table?

For example, the same customer ID may appear multiple times with different update timestamps.

Would using ROW_NUMBER() to retain the latest record be sufficient? How should we handle cases where multiple records have the same timestamp?

0 REPLIES 0