Re: Multiplying query columns
- From: "Randy Harris" <randy@xxxxxxxxxxxx>
- Date: Wed, 23 Nov 2005 00:14:06 GMT
As Doug stated, you haven't provided near enough information about what
you're doing for anyone to be of much help. Generally to get the sort of
statistic that you describe, you would need an aggregate query. Assuming
you have a table of students with some sort of unique ID, and a field called
gender, you would use something like this:
SELECT Gender, Count(StudentID) AS Students
FROM Student
Group BY Gender
This would return one line for each gender (hopefully just 2) with a count
for each.
HTH,
Randy
"Dave" <whovian223@xxxxxxxxxxx> wrote in message
news:pd97o19ms9c62fksbgrtgmtej43t69e79j@xxxxxxxxxx
> Hello
>
> I've created a student database for our program that I also need to
> get statistics from. It's in Access 2003.
>
> The statistics would be things like Male-Female percentage, percentage
> of students from various parts of the world, that sort of thing. I was
> going to start small by doing the gender statistics, but I've hit a
> bump.
>
> I have a query set up to give me all of the female students and a
> query for all the male students. Now, when I do a query to get the
> counts for both of these queries, it keeps on multiplying the two
> columns together (there are 213 Male and 225 Female, and both columns
> in the count query end up with "47925").
>
> I did a Google search on this group and found a number of responses to
> similar questions, all saying that the multiplication is because there
> is no relationships defined between the two queries and a "Cartesian
> Product" is being formulated instead. The problem is, I can't think
> of any way to relate these two queries that would result in the proper
> values being calculated. Relating the "Gender_Type ID" between the
> two gets me zero results (because each one is either Male or Female,
> so there is no common result) and it's pointless to relate the names
> in the queries either.
>
> I've been banging my head against this wall all afternoon, so any help
> would be appreciated.
>
> Thanks in advance.
>
> Dave
.
- References:
- Multiplying query columns
- From: Dave
- Multiplying query columns
- Prev by Date: Re: Multiplying query columns
- Next by Date: Re: O.T. Thinking of buying Anti-Spam for $30 - seeking comments
- Previous by thread: Re: Multiplying query columns
- Next by thread: Can IE be automated?
- Index(es):
Relevant Pages
|