Skip to content

Instantly share code, notes, and snippets.

@simonthompson99
Last active January 13, 2021 12:35
Show Gist options
  • Save simonthompson99/663170b607a418498ebc83a4b6dfdd0c to your computer and use it in GitHub Desktop.
Save simonthompson99/663170b607a418498ebc83a4b6dfdd0c to your computer and use it in GitHub Desktop.
[Update table from lookup] Update a db table using list of values #sql #database
update schema.table t
set cola = u.cola
from
(
select * from (values
(1, 'fdjkl'),
(2, 'reiuuio'),
(3, 'adfgd')
) as t (id, cola)
) u
where t.id = u.id
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment