Records counter in a query

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

I have a table to store customers' names and I need a
query to retrieve the names and to have them counted.
In a report one can do that with running sum property of a
field. Is it possible in a query?
 
It could be achieved by the use of a Union query.
Something like

SELECT 1 As RecType, customerName, 0 As RecCount
FROM CustomerTable
UNION
SELECT 2, Null, Count(customerName)
FROM CustomerTable

Hope This Helps
Gerald Stanley MCSD
 
Dear Mike:

It is possible to do this in a query if and only if you have a unique
ordering of the rows. If there is no unique ordering then you have
"ties" and there would be multiple rows with the same record count.

If you would post the SQL of a query here that shows all the columns
you want to see and with an ORDER BY that is the order in which you
want the rows counted, I will add the "record counter" (what I would
call a ranking) column to it.

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