Skip to content

Instantly share code, notes, and snippets.

@ryancutter
Created January 2, 2016 20:49
Show Gist options
  • Save ryancutter/6fa880a568564d257210 to your computer and use it in GitHub Desktop.
Save ryancutter/6fa880a568564d257210 to your computer and use it in GitHub Desktop.
update object_type set location = 'new floor' where id in (
with recursive tree (child) as (
values(cast(100 as bigint))
union
select ot.id from object_type ot, tree where ot.parent_id = child and ot.direct_location = false)
select child from tree)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment