Created
March 11, 2014 15:29
-
-
Save dalmat36/9488173 to your computer and use it in GitHub Desktop.
This file contains 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
/*ROW_NUMBER() Window function assigns | |
unique incrementing integers to rows */ | |
SELECT orderid, custid, val, ROW_NUMBER() OVER (PARTITION BY custid ORDER BY val) AS rownum | |
FROM Sales.OrderValues | |
ORDER BY custid, val; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment