[AccessD] Can't get the SQL for this

Andy Lacey andy at minstersystems.co.uk
Mon Apr 18 11:08:49 CDT 2005


Afternoon all, how's things?

Can someone help dense old me? I can't figure out how to do this.

I have 3 tables, structure of each is Code1, Code2, Qty (I'm simplifying).
Example data:

tbl1
----
A    B  36
A    B  45
B    B  21
B    C  22

tbl2
-----
A    A  9
B    B  12

tbl3
----
A    B  7
B    D  3

What I want as output is the total qty for each unique pair of Code1 and
Code2, ie

A    A  9
A    B  88
B    B  33
B    C  22
B    D  3

I started by writing a query for each table to sum qty by Code1 and Code2
then began to do a UNION query and stopped there cos I can't see how I sum
or Group across the 3 original queries in my UNION query. So I must have
started wrong but I've got a senior moment or something cos I can't see it.

Can someone please help me out?

--
Andy Lacey
http://www.minstersystems.co.uk


________________________________________________
Message sent using UebiMiau 2.7.2




More information about the AccessD mailing list