Count of Group

  • Thread starter Thread starter Tim
  • Start date Start date
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.
 
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.
 
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
 
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.
 
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.
 
Back
Top