Query to display count of each and total

sumdumgai

Registered User.
Local time
Today, 02:18
Joined
Jul 19, 2007
Messages
453
Here's my query so far:
Code:
SELECT Table1.[FLD1], Count(Table1.[FLD1]) AS HowMany
FROM Table1
GROUP BY Table1.[FLD1]
HAVING (((Count(Table1.[FLD1]))>1));
This produces a report for each FLD1 where its value occurs more than once, and the number of times that value occurs. Is there a way to also include for each FLD1 the total number of FLD1 occurrences?
Example:
FLD1 HowMany Total
aaa 2 7
bbb 2 7
ccc 3 7

Thanks
 
SELECT Table1.[FLD1], Count(Table1.[FLD1]) AS HowMany, (Select Sum(T2.A) From (Select FLD1,Count(*) As A From Table1 Group By FLD1) As T2 Where T2.A>1) As Total
FROM Table1
GROUP BY Table1.[FLD1]
HAVING (((Count(Table1.[FLD1]))>1));
 

Users who are viewing this thread

Back
Top Bottom