I’m displaying all the serial numbers that go with an order line. I’d like to give each row a sequence number starting at one each time the order/line changes.
I’ve tried ROW_NUMBER with OVER but managed only to rank the rows against the entire results.
What I’d like to see:
Order 1, Line 1, Serial 12345, Sequence 1
Order 1, Line 1, Serial 12346, Sequence 2
Order 1, Line 1, Serial 12347, Sequence 3
Order 1, Line 2, Serial 12345, Sequence 1
Order 1, Line 2, Serial 12346, Sequence 2
Order 1, Line 2, Serial 12347, Sequence 3