In Focus

Forums - C# Corner

Forum guidelines
shahnid k

shahnid k

  • 1.5k
  • 20
  • 2.6k

How to set where condition for aggregate function.

Jul 6 2017 5:46 AM
  1. select SUM(dbo.GLAFS.OPENBAL) + SUM(dbo.GLAFS.NETPERD1) AS January from GLAFS where SUM(dbo.GLAFS.OPENBAL) + SUM(dbo.GLAFS.NETPERD1) > 0  
its giving an error "
An aggregate may not appear in the WHERE clause unless it is in a subquery contained in a HAVING clause or a select list, and the column being aggregated is an outer reference" 
How can i resolve this issue. Please help.  

Answers (4)


Build smarter apps with Machine Learning, Bots, Cognitive Services - Start free.

Start Learning Now