最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

sql - Merge query, Not able to perform insert and update the records - Stack Overflow

programmeradmin4浏览0评论

I am struggling to build one query in databricks using merge statement. I have below 3 scenarios: My source table is a full load:

Target table load:

  1. If source record does not exist in target table then insert the record.

  2. If change is found in the column which is already present in target then update the existing record with active flag as N and last update date as previous date. And insert a new record in the target table with update of the column and active flag as Y

  3. If record already present in target and no change found and Target table's Active Flag column is 'Y' then update the active flag as N ( soft delete)

I am facing issue in updating and inserting record at the same time in merge query.

Any help?

发布评论

评论列表(0)

  1. 暂无评论