Last active
March 15, 2016 17:18
-
-
Save mikaelweave/45afc9c6c6626ad6dfed to your computer and use it in GitHub Desktop.
Examples on how to use row_number and rank
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
ROW_NUMBER() OVER (ORDER BY ct_id) AS row_num, | |
ROW_NUMBER() OVER (PARTITION BY source_id ORDER BY ct_id) AS partitioned_row_num, | |
RANK() OVER (ORDER BY ct_id) AS row_num, | |
RANK() OVER (PARTITION BY source_id ORDER BY ct_id) AS partitioned_row_num | |
FROM | |
ct_pstor |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment