I have a table named POS_File_Detail
. I would like to update Line_Number
based on the count of the Invoice_Number
and increment by 1 for every duplicate. So basically if I have three duplicate entries with the same Invoice_Number
it will update Line_Number
with what duplicate number it is. Something like this
Invoice_Number | Line_Number | Description
0123456 1 Pepsi
0123456 2 Chips
0123499 1 Hot dogs
0123456 3 Mustard
The primary key for this table is an autonumber field named Record_ID.
I'm not sure how to put this in correct syntax, but hopefully this will show you what I'm trying to do
UPDATE POS_File_Detail
SET POS_File_Detail.Line_Number = Line_Number +1
WHERE COUNT(Invoice_Number)>1;