Group,
I have a somewhat complex problem to explain so bear with me. I have a table called "TallyName" that shows every tally name that can occur in my database (each tally name occurs only once). I have one query called "CurrentTallies" that sums the number of tallies by tally name and source code (source code is a broader description of the type of tally: each tally can occur within each source code) for the most recent 12 month period. I have another query called "PreviousTallies" that sums the number of tallies by tally name and source code for the previous 12 month period. (Example: "PreviousTallies" for 1/1/02-12/31/02 and "CurrentTallies" for 1/1/03-12/31/03)
I am trying to create a query called "AllTallies" that will show the 10 tallies that occurred the most within the last 12 months, and then show how often they occurred in the previous 12 months. The way I thought this query should work is group by field "tally name" from table "TallyName" and sum the number of tallies from each of the 2 other queries in 2 other fields. I set up join properties to include all records from table "TallyName" and only those records from the other queries where the joined fields are equal.
When I run the query I get 9 times the data that I should. I think that this is because there are 9 different source codes, but don't know why it behaves this way. I thought that since I was grouping by tally name that it wouldn't matter how many times a tally name appears in the "PreviousTallies" and "CurrentTallies" queries. I have set up the join properties every way possible, but it doesn't seem to make any difference in the results.
I know that I could group the info without the source code in the "PreviousTallies" and "CurrentTallies" queries, but I will also be running queries similar to "AllTallies" that limit the results to only certain source codes and want to use the same source queries if at all possible.
Does anyone have any ideas?
Josh
I have a somewhat complex problem to explain so bear with me. I have a table called "TallyName" that shows every tally name that can occur in my database (each tally name occurs only once). I have one query called "CurrentTallies" that sums the number of tallies by tally name and source code (source code is a broader description of the type of tally: each tally can occur within each source code) for the most recent 12 month period. I have another query called "PreviousTallies" that sums the number of tallies by tally name and source code for the previous 12 month period. (Example: "PreviousTallies" for 1/1/02-12/31/02 and "CurrentTallies" for 1/1/03-12/31/03)
I am trying to create a query called "AllTallies" that will show the 10 tallies that occurred the most within the last 12 months, and then show how often they occurred in the previous 12 months. The way I thought this query should work is group by field "tally name" from table "TallyName" and sum the number of tallies from each of the 2 other queries in 2 other fields. I set up join properties to include all records from table "TallyName" and only those records from the other queries where the joined fields are equal.
When I run the query I get 9 times the data that I should. I think that this is because there are 9 different source codes, but don't know why it behaves this way. I thought that since I was grouping by tally name that it wouldn't matter how many times a tally name appears in the "PreviousTallies" and "CurrentTallies" queries. I have set up the join properties every way possible, but it doesn't seem to make any difference in the results.
I know that I could group the info without the source code in the "PreviousTallies" and "CurrentTallies" queries, but I will also be running queries similar to "AllTallies" that limit the results to only certain source codes and want to use the same source queries if at all possible.
Does anyone have any ideas?
Josh