Count of Group

T

Tim

Hi folks,

I need a help on my following problem.

Table:
Field1 Field2
1 1
2 1
4 1
3 2
4 2
5 1
6 3
7 8
8 10


Query:
SELECT Table3.Field2
FROM Table3
GROUP BY Table3.Field2;

Output:
Field2
1
10
2
3
8

The output is not I expected. I want to have the count of
group (5). Could anyone show me how to do it?

Thanks in advance.

Tim.
 
T

Tim

Lynn,

I tried the sql but the result is not I am looking for. I
need the following output.

Output:
Field2
5 --5 group

Thanks.

Tim.
 
B

Brian Camire

You might try:

SELECT
Count(*)
FROM
(SELECT DISTINCT
Table3.Field2
FROM
Table3)

If you're using Access 97 or earlier, you'll need to create a saved query
(say named Query1) for

SELECT DISTINCT
Table3.Field2
FROM
Table3

and then select from it instead, as in

SELECT
Count(*)
FROM
Query1
 
T

Tim

Brian,

I am using access97. I know the method you stated but I
want to know is it possible to use a query to do the job.

Could you help me?

Thank.

Tim.
 
D

Douglas J. Steele

Um, that IS a query he gave you, Tim! Okay, so it's two queries, but they
play together seamlessly, so the end result is identical to having only a
single query.
 

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