Link to home
Start Free TrialLog in
Avatar of Zolf
ZolfFlag for United Arab Emirates

asked on

SQL query dont show Subtrated values which are 0

Hello there,

I have this select query which subtracts two columns and then I have a SUm on them. It is working as I am expecting but can I refine my result so that the value 0 is not included in the result

SELECT
    dbo.Branch.code,
     dbo.Branch.name        AS Branch,
    SUM(dbo.WarehouseProductQuantity.actualQuantity - dbo.WarehouseProductQuantity.reservedQuantity
    ) AS AvailQty

Open in new window


cheers
ZOlf
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Select code, Branch, AvailQty
From (
SELECT code
            , name AS Branch
            , SUM(actualQuantity - reservedQuantity ) AS AvailQty
From dbo.Branch) As D (code, Branch, AvailQty)
Where AvailQty > 0

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial