SQLTeam.com | Weblogs | Forums

How do calulate sum of an array in SQL?

sql2008r2

#1

In excel there is a simple formula to calculate the number of items in an array. See the attached image. How can a column Q be calculated using SQL?


#2

I think we will need more than just a screen shot of Excel. What is the relationship between the highlighted columns.


#3
SELECT Sum(CASE WHEN [condition check] THEN 1 ELSE 0 END)
FROM SourceObject;