Skip to content
Advertisement

Sql Synapse How to update the latest records

Table MAPPING

Table MASTER

Output after update

Table MAPPING

I have an issue to update data in Mapping, I’d like to update only latest records.

Note: 1 CUST_ID : M ID thus I need to partition by cust_id order by upd_dt DESC,ID ASC to get the latest records.

I’d like to update only rows

Parse error at line: 33, column: 42: Incorrect syntax near ‘,’.

which is WHERE (SRC.ID,SRC.CUST_ID) IN

Advertisement

Answer

Assuming Azure Synapse is T-SQL compliant, you may use an updatable CTE here:

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement