So I have 2 tables One is a supply table and the other is a table of all checkouts of specific models:
Table 1 Checkouts
Model | Checkout quantity |
---|---|
JD33 | 5 |
Table 2 Supply racks
Model | Total quantity |
---|---|
JD33 | 90 |
ABC1 | 75 |
What I want to do is subtract checkout quantity from total quantity. So essentially what I'm getting is this:
Table 3
Model | Total quantity |
---|---|
JD33 | 85 |
I am only getting back models that are in my checkout list. If it is not in the checkout list I want the total quantity to stay the same and still be visible within the table.
Here is my current query:
select SILVER_RACKS.QTY as QTY,
SILVER_RACKS.MODEL as MODEL,
SILVER_RACKS.QTY-CHECKOUT_TOTAL.CHECKOUT_QTY as total_QTY
from SILVER_RACKS SILVER_RACKS,
CHECKOUT_TOTAL CHECKOUT_TOTAL
where SILVER_RACKS.MODEL=CHECKOUT_TOTAL.MODEL
Which is returning as described above.