Skip to content

Instantly share code, notes, and snippets.

@dfbag7
Created July 4, 2016 07:45
Show Gist options
  • Save dfbag7/349e7144bdcfa327dfdb00c68247c5c8 to your computer and use it in GitHub Desktop.
Save dfbag7/349e7144bdcfa327dfdb00c68247c5c8 to your computer and use it in GitHub Desktop.
update workgroups
set name = workgroups.name || ' (' || d.rnk::text || ')'
from (select id, row_number() over (partition by name order by updater_txn_id, id) as rnk from workgroups) d
where workgroups.id = d.id and d.rnk > 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment