Skip to content
Advertisement

MYSQL Update Column with higher values from other table

I’m having two tables in an mysql database. TABLE_A

I want to update Table_A with values from Table_B, but only if they are higher. Has anyone a snippet for me?

Advertisement

Answer

One option uses the update/join syntax:

If there are no duplicate ids in table_b, no need for aggregation:

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