Figure 3: Row number, within partitions (custid), sorted by unique column (orderid)
custid custrownum orderid orderdate empid qty
A 1 10005 2003-12-24 1 30
A 2 40001 2004-01-09 4 40
A 3 40005 2004-02-12 4 10
B 1 20001 2004-02-12 2 20
B 2 30001 2003-08-02 3 10
B 3 30003 2004-04-18 3 15
B 4 30004 2004-04-18 3 20
C 1 10001 2003-12-24 1 10
C 2 10006 2004-01-18 1 10
C 3 20002 2004-02-16 2 20
C 4 30007 2004-09-07 3 30