Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zaidysf/98fb9664c869f811bea2b40be8ff0bac to your computer and use it in GitHub Desktop.
Save zaidysf/98fb9664c869f811bea2b40be8ff0bac 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