Dear All, I’ve the following problem. I need to compare two tables, sum records by description and calculate the difference.
190511 and 200511 are identical in structure but different in data. Both are connected with column RefId in format (100-110 etc)
Table00
RefId|Description|Qty
100-101|Elbow90|1
100-102|Elbow90|1
100-103|Tee1x1|1
100-104|Tee2x2|1
100-105|Tee3x3|1
100-110|Flange|1
Table01
RefId|Description|Qty
100-101|Elbow90|1
100-102|Elbow90|1
100-104|Tee2x2|1
100-106|Flange|1
100-107|Flange|1
I use Access. I can’t use FULL JOIN so I wrote:
SELECT Table00.RefId, Table00.Description, Table00.Qty, Table01.RefId, Table01.Description, Table01.Qty
FROM Table00 LEFT JOIN Table01 ON Table00.RefId = Table01.RefId
UNION SELECT Table00.RefId, Table00.Description, Table00.Qty, Table01.RefId, Table01.Description, Table01.Qty
FROM Table00 RIGHT JOIN Table01 ON Table01.RefId = Table00.RefId;
Now, how to sum elements in Table00 and Table01 by description and put the difference? Is it possible in SQL in this move or I need to sum then records in program.
Thank you in advance.
Mike