I need a row number field in a query. The query is based on a table that has an autonumber field however there are deletions so I have gaps that I cannot have in the query results. I have read the many posts on this but none of them seem to fit exactly what I need.
In addition to the statement below I need a column that is simply the row number or a counter. Starts at 1 and goes on til the end incrementing by 1 each row.
SELECT DISTINCT dbo_tblPRDMSTR.ACTIV, dbo_tblPRDMSTR.CMPNO, dbo_tblPRDMSTR.PRDNO, dbo_tblPRDMSTR.DESCP, dbo_tblPRDMSTR.GITYP, dbo_tblPRDMSTR.PKGWT
FROM dbo_tblPRDMSTR
WHERE (((dbo_tblPRDMSTR.ACTIV)="1") AND ((dbo_tblPRDMSTR.CMPNO)=516) AND ((dbo_tblPRDMSTR.GITYP)="FG" Or (dbo_tblPRDMSTR.GITYP)="FR"));
This query runs on the click of a command button I made that outputs the results as a csv so the user can upload into another system. The other system has a requirement that there be row numbers.
Thanks!
In addition to the statement below I need a column that is simply the row number or a counter. Starts at 1 and goes on til the end incrementing by 1 each row.
SELECT DISTINCT dbo_tblPRDMSTR.ACTIV, dbo_tblPRDMSTR.CMPNO, dbo_tblPRDMSTR.PRDNO, dbo_tblPRDMSTR.DESCP, dbo_tblPRDMSTR.GITYP, dbo_tblPRDMSTR.PKGWT
FROM dbo_tblPRDMSTR
WHERE (((dbo_tblPRDMSTR.ACTIV)="1") AND ((dbo_tblPRDMSTR.CMPNO)=516) AND ((dbo_tblPRDMSTR.GITYP)="FG" Or (dbo_tblPRDMSTR.GITYP)="FR"));
This query runs on the click of a command button I made that outputs the results as a csv so the user can upload into another system. The other system has a requirement that there be row numbers.
Thanks!