Sequential Numbering in Query Field

DBFIN

Registered User.
Local time
Today, 16:21
Joined
May 10, 2007
Messages
205
I have a query that groups the data by customer. How can I create a "Transaction Number" field where I assign a sequential number to each invoice, starting at 1 with the oldest invoice and increasing the sequential number by 1 with each invoice. I need to create this field in a query without code. Please see file attachment.
 

Attachments

Usually you would design your tables and relationships based on your business rules.
We don't know your business, and you haven't told us much of your environment or set up.
An Invoice is typically created for a Customer when they purchase some Product(s) , Service(s) or Item(s) as part of an Order.

see the free data model at
http://www.databaseanswers.org/data_models/customers_and_invoices/index.htm
 
Try the below query, (remember to change the table name to what you call it.).
SELECT Table1.Customer, Table1.Invoice, Table1.InvoiceDate, (select Count(*) from table1 as table1_1 where table1_1.invoiceDate<=table1.invoiceDate) AS TransActionNumber
FROM Table1
ORDER BY Table1.InvoiceDate;
 

Users who are viewing this thread

Back
Top Bottom