Subject Case statement returns null
Author dinol.softedge
Hi All

I have the following statement to determine whether stock is coming in
or going out and assign the correct sign (+ or -) to a column called
real_quantity. Problem is that the real_quantity always returns null.
Any help would be greatly appreciated. Thanks

SELECT
TBL_INV_TRANS.INV_TRANS_ID,
TBL_INV_TRANS.INVENTORY_ID,
TBL_INV_TRANS.IN_OUT,
TBL_INV_TRANS.DESCRIPTION,
TBL_INV_TRANS.LOCATION_ID,
TBL_INV_TRANS.COST_PRICE,
TBL_INV_TRANS.PURCHASE_ID,
TBL_INV_TRANS.JOB_CARD_ID,
TBL_INV_TRANS.DATE_TIME,
TBL_INV_TRANS.USER_NAME,
TBL_INV_TRANS.SELLING_PRICE,
TBL_INV_TRANS.ITEM_DISCOUNT,
TBL_INV_TRANS.QUANTITY,
CASE
WHEN IN_OUT = 'IN' THEN QUANTITY
WHEN IN_OUT = 'OUT' THEN QUANTITY * -1
END AS REAL_QUANTITY
FROM
TBL_INV_TRANS