Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

redo unon to sum?

Status
Not open for further replies.

ttuser4

MIS
Joined
Jun 19, 2008
Messages
147
Location
CA
hi,
how can i redo this query:

SELECT Sum(EXPENSES.AMOUNT) AS TOT_EXPENSE
FROM EXPENSES
HAVING (((EXPENSES.ACCT_NUM)=[forms]![projects]![text19]))
UNION SELECT Sum(EXPINT.AMOUNT) AS TOT_EXPENSE
FROM EXPINT
HAVING (((EXPINT.ACCT_NUM)=[forms]![projects]![text19]));

so it would give me one total sum instead of two lines with sum from each select statement?
 

Select Sum(A.TOT_EXPENSE)
from(
SELECT Sum(EXPENSES.AMOUNT) AS TOT_EXPENSE
FROM EXPENSES
HAVING (((EXPENSES.ACCT_NUM)=forms!projects!text19))
UNION SELECT Sum(EXPINT.AMOUNT) AS TOT_EXPENSE
FROM EXPINT
HAVING (((EXPINT.ACCT_NUM)=forms!projects!text19))
)a
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top