Sum of Table

  • Thread starter roystonteo via AccessMonster.com
  • Start date
R

roystonteo via AccessMonster.com

Dear All,

Table A: Part No, AQty
Table B: Part No, BQty

Query A: Total_of_AQty
Qtuery B: Total_of_BQty

When i do a union select for Query A and B
UNION SELECT quantity *1

If happen that Table A and Table B
Has the same part number and same quantity, they will not sum up.
Am i in the wrong track?
 
J

John W. Vinson

Dear All,

Table A: Part No, AQty
Table B: Part No, BQty

Query A: Total_of_AQty
Qtuery B: Total_of_BQty

When i do a union select for Query A and B
UNION SELECT quantity *1

If happen that Table A and Table B
Has the same part number and same quantity, they will not sum up.
Am i in the wrong track?

UNION will remove duplicates, so if there are identical records in QueryA and
Query B you'll only get one of them. Use UNION ALL if you want both records.
You'll then need to do *another* totals query based on the union query.
 
R

roystonteo via AccessMonster.com

Dear John,

Thank you so much!
Dear All,
[quoted text clipped - 10 lines]
Has the same part number and same quantity, they will not sum up.
Am i in the wrong track?

UNION will remove duplicates, so if there are identical records in QueryA and
Query B you'll only get one of them. Use UNION ALL if you want both records.
You'll then need to do *another* totals query based on the union query.
 
Top