Link to home
Start Free TrialLog in
Avatar of HKFuey
HKFueyFlag for United Kingdom of Great Britain and Northern Ireland

asked on

SQL View Syntax case etc

I want to add a number of fields, check if the result is greater than zero, then divide by number of months.

Something like: -

case (dbo.Table.SalesQty1 + dbo.Table.SalesQty2 + dbo.Table.SalesQty3 + dbo.Table.SalesQty4 + dbo.Table.SalesQty5 + dbo.Table.SalesQty6) >0 then (dbo.Table.SalesQty1 + dbo.Table.SalesQty2 + dbo.Table.SalesQty3 + dbo.Table.SalesQty4 + dbo.Table.SalesQty5 + dbo.Table.SalesQty6) / 6

Open in new window


Can anyone help with the syntax?
ASKER CERTIFIED SOLUTION
Avatar of Guy Hengel [angelIII / a3]
Guy Hengel [angelIII / a3]
Flag of Luxembourg 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
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
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
Avatar of HKFuey

ASKER

You all replied pretty much the same time, thanks for the quick response. You got it working!