This question would be more appropriate in MS: Access Queries. However, you must define what field or fields determine the order. Why would one record have a SeqNbr of 1 and another of 2?
There should be some examples of how to do this in the query FAQs. If not, come back with your table name and significant fields with data types.
I don't think it is possible in a query so I was thinking that a module would be necessary.
The query pulls data from a table and adds some additional default fields. The query name is PG_COMM.
The main fields are:
EMPLID
EARN_CD
EARN_AMT
EARN_BEGIN_DT
EARN_END_DT
I need to add the sequence field and am open to doing this in anyway. In the end I will need to export the final either query or table to a .csv file as it will be uploaded to another system.
Again, [tt][red]you must define what field or fields determine the order[/red][/tt]. Is the EARN_BEGIN_DT the sequencing field? If so, your query might look like:
Code:
SELECT PG_COMM.EMPLID,Count(PG_COMM_1.EMPLID) AS SeqNbr
FROM PG_COMM LEFT JOIN PG_COMM AS PG_COMM_1 ON PG_COMM.EMPLID = PG_COMM_1.EMPLID
WHERE PG_COMM.EARN_BEGIN_DT<=PG_COMM_1.EARN_BEGIN_DT
GROUP BY PG_COMM.EMPLID
ORDER BY PG_COMM.EMPLID;
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.