Skip to content
Advertisement

SQL Merge update

my merge query

and got error

The MERGE statement attempted to UPDATE or DELETE the same row more than once. This happens when a target row matches more than one source row. A MERGE statement cannot UPDATE/DELETE the same row of the target table multiple times. Refine the ON clause to ensure a target row matches at most one source row, or use the GROUP BY clause to group the source rows.

this is resource table

This is target table

I expect this result

Advertisement

Answer

Why not just use update?

You don’t specify the error, so I don’t know if this will fix it. But it is a simpler approach.

and got error

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