count the number of rows in a query.

R

randria

Hi,
i have a query Q2 that is based on another query CountUnit1. what I want is
to get the total number of rows of Q2 after running the query. How do I do
that ?
Below is what I have tried but it does not complete the job.

SELECT IIf([Bed]<>0,1,0) AS Row, CountUnit1.[File Reference],
CountUnit1.Roomate
FROM CountUnit1
GROUP BY IIf([Bed]<>0,1,0), CountUnit1.[File Reference], CountUnit1.Roomate;

The above statement sets the value of Row to 1, and I thought if I could sum
that row I would get the total number of rows, but it didn't.

How do I go about this, is it possible to have running sum in a query ?


For exemple , I get 5 rows after running the query, I want to get the number
5.

Many thanks
 
R

randria

Hi
Excellent ! It works, thank you so much.
cheers.

Allen Browne said:
SELECT Count("*") AS HowMany FROM Q2;

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

randria said:
Hi,
i have a query Q2 that is based on another query CountUnit1. what I want
is
to get the total number of rows of Q2 after running the query. How do I do
that ?
Below is what I have tried but it does not complete the job.

SELECT IIf([Bed]<>0,1,0) AS Row, CountUnit1.[File Reference],
CountUnit1.Roomate
FROM CountUnit1
GROUP BY IIf([Bed]<>0,1,0), CountUnit1.[File Reference],
CountUnit1.Roomate;

The above statement sets the value of Row to 1, and I thought if I could
sum
that row I would get the total number of rows, but it didn't.

How do I go about this, is it possible to have running sum in a query ?


For exemple , I get 5 rows after running the query, I want to get the
number 5.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top