Skip to content

Instantly share code, notes, and snippets.

@simonthompson99
Last active January 13, 2021 12:35
Show Gist options
  • Select an option

  • Save simonthompson99/663170b607a418498ebc83a4b6dfdd0c to your computer and use it in GitHub Desktop.

Select an option

Save simonthompson99/663170b607a418498ebc83a4b6dfdd0c to your computer and use it in GitHub Desktop.

Revisions

  1. simonthompson99 revised this gist Jan 13, 2021. No changes.
  2. simonthompson99 created this gist Jul 24, 2020.
    12 changes: 12 additions & 0 deletions update_table_from_lookup.sql
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    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
    ;