Option count into a query

  • Thread starter Thread starter Oli
  • Start date Start date
O

Oli

I have a query on three table. I need to count the number
of line (regarding the query result) by ID number
 
Dear Oli:

Simply producing the count of the number of lines produced by a query
would be quite independent of any column of the results. Perhaps you
want a ranking column that counts down the rows starting from 1. If
so, you might start from a query like this:

SELECT ID,
(SELECT COUNT(*) + 1 FROM YourTable T1
WHERE T1.ID < T.ID) AS Rank
FROM YourTable T
ORDER BY ID

Add other columns as desired

Tom Ellison
Microsoft Access MVP
Ellison Enterprises - Your One Stop IT Experts
 
Back
Top