I need help with this SQL problem (using Microsoft SQL Server Management Studio,
ID: 3661785 • Letter: I
Question
I need help with this SQL problem (using Microsoft SQL Server Management Studio, NOT MySQL!).
I need to write this problem in two separate methods, ex: one way showing subqueries and one with joins.
Here is what I have so far:
SELECT Part, Description, ReorderPnt, StockQty
FROM INVENTORY WHERE StockQty < ReorderPnt;
I know I need to make another column somehow with the difference of the two and then output that column, but I have no idea about the syntax.
Please help me, I need to show this written in two different ways!
Explanation / Answer
SELECT INVENTORY.Part, INVENTORY.Description, INVENTORY.ReorderPnt - INVENTORY.StockQty DIFF
FROM INVENTORY WHERE StockQty < ReorderPnt ORDER BY INVENTORY.Part DESC;