开发者

Getting percentages for every set of results returned via SQL

I want to know if there is a way to somehow find out the passing percentage of each set of the query results

  select testcase_execution_result
  from table_testcase_execution
  where
     campaign_session_id = any
        (
            SELECT campaign_session开发者_运维问答_id
            FROM table_campaign_session
            WHERE campaign_session_name = '{$clientsformatted}'
        )
     AND 
     timestamp between '{$stimestamp}000' AND '{$etimestamp}999'
  order by timestamp ASC
  limit $4 offset 0

this query returns 96 results, and what i have to do is find out what is the passing rate for each set, each hour 4 tests run and the results are stored, 1 for pass and 2 for fail.

I would like to know a way to somehow loop through these and find out what the passing rate is for each hour. somehow with the query i have above keep adding to the offset 4 to get the next set and get the passing rate of each 4 and return that. should be 24 separate percentages.

thanks!


something in this area:

 select PERC(testcase_execution_result)....
 ...
 ...
 GROUP BY timestamp between '{$stimestamp}000' AND '{$etimestamp}999'
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜