Skip to content

Instantly share code, notes, and snippets.

@senyaitiya
Last active April 23, 2021 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save senyaitiya/4bb10b07ff4c7d124fd8735ac9ad70d1 to your computer and use it in GitHub Desktop.
Save senyaitiya/4bb10b07ff4c7d124fd8735ac9ad70d1 to your computer and use it in GitHub Desktop.
UPDATE
TABLE
SET
no = TA_2.no 
FROM
TABLE TA
INNER JOIN (
SELECT
id
,RANK() OVER (ORDER BY id) AS no
FROM
TABLE
WHERE
age >= 20
)TA_2
ON
TA.id = TA_2.id
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment