I have a table with customers and their info
I'd like to rank each customer separatley
so customerid will have 1,2,3 4 for all their entries
and then customerid 2 will start again with 1 , and rank each of their entries
is this possible?
SELECT CustomerID
, OtherColumn
, RANK() OVER(PARTITION BY CustomerID ORDER BY OtherColumn) AS ranking
FROM CustomerTable
As long as you PARTITION BY CustomerID, you can ORDER BY whichever column(s) you want ranked.
thanks this did work!