I need a function or something that can give me a bucket that increments by 1 at each change in data that is not unique (but it is sorted correctly)... See below, I need to produce the GROUP_ID at every change in invoice date then line_number (notice invoice date is not unique, niether is line number, its just simply sorted correctly...) :
INVOICE_DATE | LINE_NUMBER | AMOUNT | GROUP_ID
----------------------------------------------
30-APR-2010 | 1 | 25 | 1
30-APR-2010 | 2 | 15 | 1
31-MAR-2010 | 1 | 18 | 2
31-MAR-2010 | 2 | 4 | 2
31-MAR-2010 | 3 | 60 | 2
30-APR-2010 | 1 | 9 | 3
30-APR-2010 | 2 | 15 | 3
Any help would be appreciated.
INVOICE_DATE | LINE_NUMBER | AMOUNT | GROUP_ID
----------------------------------------------
30-APR-2010 | 1 | 25 | 1
30-APR-2010 | 2 | 15 | 1
31-MAR-2010 | 1 | 18 | 2
31-MAR-2010 | 2 | 4 | 2
31-MAR-2010 | 3 | 60 | 2
30-APR-2010 | 1 | 9 | 3
30-APR-2010 | 2 | 15 | 3
Any help would be appreciated.