Avatar of Zolf
Zolf
Flag 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
Microsoft SQL ServerMicrosoft SQL Server 2008SSRS

Avatar of undefined
Last Comment
Mike Eghtebas

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Ryan Chong

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Mike Eghtebas

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
Ryan Chong

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
SOLUTION
Mike Eghtebas

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
Your help has saved me hundreds of hours of internet surfing.
fblack61