как разделить два запроса - PullRequest
0 голосов
/ 03 мая 2018

Я хочу разделить ниже два запроса:

1-й запрос:

select count_value from (select count(*) 
from jmeter 
where "project" = 'testmatrix' 
AND "suite" = 'apitest' 
AND "build"='132' 
AND "status" = 'ok' 
AND "page" != 'all' 
AND "metric" = 'count' 
AND "value"=0)

2-й запрос:

select count_value 
from (select count(*) from jmeter 
where "project" = 'testmatrix' 
AND "suite" = 'apitest' 
AND "build"='132' 
AND "status" = 'ok' 
AND "page" != 'all' 
AND "metric" = 'count')

Ваша помощь будет оценена, спасибо.

Ответы [ 2 ]

0 голосов
/ 03 мая 2018
SELECT SUM(CASE WHEN "Value"  = 0 THEN 1 ELSE 0 END)/COUNT(*) 
from jmeter 
where "project" = 'testmatrix' 
AND "suite" = 'apitest' 
AND "build"='132' 
AND "status" = 'ok' 
AND "page" != 'all' 
AND "metric" = 'count'
0 голосов
/ 03 мая 2018

Это поможет.

select sum(f_query)/ sum(S_query) as Result 
from (
    select  count(*) as f_query , 0 as S_query from jmeter where "project" = 'testmatrix' AND "suite" = 'apitest' AND "build"='132' AND "status" = 'ok' AND "page" != 'all' AND "metric" = 'count' AND "value"=0
    union all
    select 0 as f_query , count(*) as S_query  from jmeter where "project" = 'testmatrix' AND "suite" = 'apitest' AND "build"='132' AND "status" = 'ok' AND "page" != 'all' AND "metric" = 'count'
) as GroupTable
...