Skip to content

Instantly share code, notes, and snippets.

@monaye
Created April 12, 2018 03:04
Show Gist options
  • Select an option

  • Save monaye/84f9768010d23844e9faa28a331adc04 to your computer and use it in GitHub Desktop.

Select an option

Save monaye/84f9768010d23844e9faa28a331adc04 to your computer and use it in GitHub Desktop.
Update column value based on same table's row of other column value
UPDATE
tableA
SET
columnA = SUB.columnB
FROM
( select id, columnB FROM tableA ) as SUB
WHERE
tableA.id = SUB.id;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment