R
RJF
I have created 2 queries that are joined in a final query. I'm trying to
figure out a way to have one query that will do it all instead of taking 3
queries to get the results.
Any suggestions? Please let me know if I haven't explained myself clearly
or if you need additional information.
qry_test_02
SELECT dbo_oss_equip.ACCTNO, dbo_oss_equip.ID
FROM dbo_oss_equip
GROUP BY dbo_oss_equip.ACCTNO, dbo_oss_equip.ID
HAVING (((dbo_oss_equip.ACCTNO)="188955"));
qry_test_01
SELECT dbo_oss_tran.machine, Sum(dbo_oss_tran.cost_units) AS SumOfcost_units
FROM dbo_oss_tran
WHERE (((dbo_oss_tran.ACCTNO)="188955") AND ((dbo_oss_tran.DATE)>=#1/1/2009#))
GROUP BY dbo_oss_tran.machine;
Final Query
SELECT qry_test_02.ID, qry_test_01.SumOfcost_units
FROM qry_test_01 RIGHT JOIN qry_test_02 ON qry_test_01.machine =
qry_test_02.ID;
Thank you very much.
figure out a way to have one query that will do it all instead of taking 3
queries to get the results.
Any suggestions? Please let me know if I haven't explained myself clearly
or if you need additional information.
qry_test_02
SELECT dbo_oss_equip.ACCTNO, dbo_oss_equip.ID
FROM dbo_oss_equip
GROUP BY dbo_oss_equip.ACCTNO, dbo_oss_equip.ID
HAVING (((dbo_oss_equip.ACCTNO)="188955"));
qry_test_01
SELECT dbo_oss_tran.machine, Sum(dbo_oss_tran.cost_units) AS SumOfcost_units
FROM dbo_oss_tran
WHERE (((dbo_oss_tran.ACCTNO)="188955") AND ((dbo_oss_tran.DATE)>=#1/1/2009#))
GROUP BY dbo_oss_tran.machine;
Final Query
SELECT qry_test_02.ID, qry_test_01.SumOfcost_units
FROM qry_test_01 RIGHT JOIN qry_test_02 ON qry_test_01.machine =
qry_test_02.ID;
Thank you very much.