Skip to content
Advertisement

SQL Conditional Print Statement

I am working on two different tables: sales and inventory. From the table inventory, there’s Quantity_Received and from the table sales, there’s Quantity_Sold. Quantity Remaining in Store represents the difference between Quantity_Received and Quantity_Sold.

When the Quantity Remaining in Store is equal to 0, I want SQL to print ‘Out of stock’. When the Quantity Remaining in Store is greater than 0 but less than 10, I want SQL to print Low stock. When the Quantity Remaining in Store is greater than 10, I want SQL to print Still in stock

Here is the query I am using currently:

Advertisement

Answer

Something like

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement