Dividing 2 columns from selcetion queries

  • Thread starter Thread starter Paul
  • Start date Start date
P

Paul

I am trying to divide 2 columns to create a new one from the output. Both
columns are stored in two different selection queries. Is it even possible
for the division to happen? The help menu hasn't shown me anything that
proves yes or no. Here what my code looks like:
SELECT Query1.Column1 AS UniqueNumber,
[Query1.IndividualItems]/[Query2.TotalItemsByIndividual] AS NewColumn
FROM Query1, Query2
GROUP BY Query1.Column1;
 
What relates a record (row) in query1 to an equivalent record in query2?

Your current query combines every row in query1 to every row in query2.
I suspect that you need to match one record in query1 to one record
in query2.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
That is what I want to do. I'll explain a bit further to help you get better
picture; I really appreciate your help.

In Query1 I have multiple items per UniqueNumber. In Query2 I have Counted
all items per UniqueNumber and then grouped by the UniqueNumber. In this new
query, I want to get a percentage of the occurence of the items by dividing
each individual item by the Count of items in that UniqueNumber.
--
Paul


John Spencer said:
What relates a record (row) in query1 to an equivalent record in query2?

Your current query combines every row in query1 to every row in query2.
I suspect that you need to match one record in query1 to one record
in query2.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================

I am trying to divide 2 columns to create a new one from the output. Both
columns are stored in two different selection queries. Is it even possible
for the division to happen? The help menu hasn't shown me anything that
proves yes or no. Here what my code looks like:
SELECT Query1.Column1 AS UniqueNumber,
[Query1.IndividualItems]/[Query2.TotalItemsByIndividual] AS NewColumn
FROM Query1, Query2
GROUP BY Query1.Column1;
 
Back
Top