khsaunderson
Technical User
I am trying to write a bit of SQL in Access where I get a sequence dependent upon a field, eg
ROCD CACD SEQ
0001 0001 001
0001 0002 002
0002 0001 001
0003 0001 001
etc
I've tried writing a row over partition, but I keep on getting an error saying "Syntax error (missing operator) in query expression 'xxx'."
The code I'm using is:
I assume that Access can't handle row_number queries, but is there some other function I could use instead? I don't want the numbers to increment all the way through - only where there are more that 1 record per ROCD.
Thanks
ROCD CACD SEQ
0001 0001 001
0001 0002 002
0002 0001 001
0003 0001 001
etc
I've tried writing a row over partition, but I keep on getting an error saying "Syntax error (missing operator) in query expression 'xxx'."
The code I'm using is:
Code:
SELECT DISTINCT ROCD,
CACD,
ROW_NUMBER() OVER(PARTITION BY CACD ORDER BY CACD) AS SEQ
FROM PACK
I assume that Access can't handle row_number queries, but is there some other function I could use instead? I don't want the numbers to increment all the way through - only where there are more that 1 record per ROCD.
Thanks