Counting two groups at once

hangglide

Hangglider
Local time
Today, 07:51
Joined
May 9, 2001
Messages
35
Is it possible to count two groups at once in the same query? For example I would like to know the number of species and a count of species from the following simplified version of my database:

sample (sampleID, lots_of_sample_information)
fish (fishID, sampleID, species, information_specific_to_this_fish)

I would like a query with this information

query(sampleID, Count_of_Species, Count_of_Individuals_in_Sample)

Or in english, sample 1 has 5 species and 38 individuals.

In my query I can group by species and get a total number of species for each sample.

OR

I can group by sample and count the total number of fish per sample.

Is it possible to do both in the same query?

Leo
 
Use a subselect as a column to count one or the other or both depending on your main query.
 
What are you using the query for? I think you could do this in a form or a report using subforms or subreports.
 
I am simply tyring to make a summary table to export into some statistical software. The more I can get Access to do before I export, the less work there is to do in the statistical software (cuutting, pasting, pivot-tables etc...) So far I have found subforms (for this purpose) are a little clumsy. I haven't looked at the reports and sub-reports too much. I will give it a shot.

Leo
 
Last edited:
Just a thought, a SUBSELECT in a query is basically the same thing as a Subreport is to a report or Subform is to a form.
 

Users who are viewing this thread

Back
Top Bottom