sum of two table by using query

L

Lawrence

Hi,

can anyone tell me how to sum two table by using a query

Table A Table B
1 2
2 3
3 4

I want my total is = 15

Thanks in advance
Lawrence
 
J

John Spencer

One solution would be to use a UNION query as the source for a totals query

SELECT numberField
FROM TableA
UNION ALL
SELECT numberField
FROM TableB

NOw use that query in another query
SELECT Sum(NumberField)
FROM UnionQuery

Of course, you might be able to use the DSum Function in a form or a report or
in VBA to accomplish what you want.

DSum("NumberField","TableA") + DSum("NumberField","TableB")

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
 
Top