AnsweredAssumed Answered

Dividing SELECT COUNT query

Question asked by LucasRusse on Jun 24, 2015
Latest reply on Jun 25, 2015 by LucasRusse

Title

Dividing SELECT COUNT query

Post

Hi folks,

I'm just getting started integrating ExecuteSQL and I'm having difficulty with a calculation that returns ? when I try to divide some counts. This arrangement will return an array of comma-separated counts just fine: 

ExecuteSQL ( 
    "SELECT COUNT( CASE Overall WHEN 'true' THEN 1 ELSE NULL END ),COUNT(id)
    FROM Evaluations
    GROUP BY FiscalWeek" ; 
    "," ; "¶" 
)

 

I also find that this will return an array of .5:

ExecuteSQL ( 
    "SELECT 1/2
    FROM Evaluations
    GROUP BY FiscalWeek" ; 
    "," ; "¶" 
)

 

But as soon as I try to divide the two counts, it returns a ? and I can't figure out why. Here's the code as I would like it to run. Basically I am trying to generate a percentage via this query and haven't been succeeding.  

ExecuteSQL ( 
    "SELECT COUNT( CASE Overall WHEN 'true' THEN 1 ELSE NULL END ) / COUNT(id)
    FROM Evaluations
    GROUP BY FiscalWeek" ; 
    "," ; "¶" 
)

 

Thank you very much for your time! 

Outcomes