Compare 2 tables

G

Guest

Hi
I need to compare the quantities in 2 tables and list the fields side by
side.
I need all records from Table1 and all records from Table2.
Table1 fields:
PN
AQty

Table2 fields:
PN
SQty

The field PN is common from both tables.
What I need a list to compare the 2 Qtys, as such:
PN
AQty
SQty

This way I can compare the difference between AQty and SQty for each PN.
Can anyone help me with this? Thanks so much.
 
D

Douglas J. Steele

SELECT Table1.PN, Table1.AQty, Table2.SQty, (Table1.AQty - Table2.SQty) AS
Difference
FROM Table1 INNER JOIN Table2
ON Table1.PN = Table2.PN
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top