I have two queries pulling data and manipulating it based on two separate tables. The Queries are each grouped by month and year and so info for the last 24 months. I am making a 3rd query that takes the data from each query and manipulates that. However when i do this it multiplies the entire table by a single field, instead of just two fields. Heres an example, (i know that made little sense)
Query 1:
Year, Month, Total Billed, Total Recieved
2008, jan, 100, 90
2009, may, 212, 118
Query 2:
Year, Month, TPS, TV, AP/H
2008, jan, 50, 4, 3.5
2009, may, 60, 5, 3.2
All the info from these queries are taken from seprate, but related tables.
This is basicly what my sql code looks like for the 3rd table and what it generates.
Query 3
Year, Month, AP/H, B/V
2008, Jan, 3.5, 25
2009, may, 3.2, 20
2008, Jan, 3.5, 53
2009, may 3.2 42.3
It's basically dividing each month from query 2 twice, once for each month of Query 1. Hence the 4 results. How would i be able to get it to just calculate like months.
Thanks
Query 1:
Year, Month, Total Billed, Total Recieved
2008, jan, 100, 90
2009, may, 212, 118
Query 2:
Year, Month, TPS, TV, AP/H
2008, jan, 50, 4, 3.5
2009, may, 60, 5, 3.2
All the info from these queries are taken from seprate, but related tables.
This is basicly what my sql code looks like for the 3rd table and what it generates.
Code:
Select [AP/H],
[Query 2].Year,
[Query 2].month
[Total Billed]/[TV] AS [B/V]
FROM [Query 1], [Query 2]
GROUP BY [Year], [Month]
Query 3
Year, Month, AP/H, B/V
2008, Jan, 3.5, 25
2009, may, 3.2, 20
2008, Jan, 3.5, 53
2009, may 3.2 42.3
It's basically dividing each month from query 2 twice, once for each month of Query 1. Hence the 4 results. How would i be able to get it to just calculate like months.
Thanks