如何在此查询中将Diff_In_Secs提升180秒以上?
select trunc(a.RECEIVED_TS) day,
to_char(avg(extract(minute from b.RECEIVED_TS - a.RECEIVED_TS)*60 + extract(second from b.RECEIVED_TS - a.RECEIVED_TS)), '999.99') Diff_In_Secs,
count(*)
from nps_request a,
nps_reply b
where a.id = b.ID
and a.RECEIVED_TS > trunc(sysdate) - 10
and b.target_id is not null
and b.RECEIVED_TS is not null
group by trunc(a.RECEIVED_TS)
order by trunc(a.RECEIVED_TS) desc;
答案 0 :(得分:1)
使用select:
包装查询SELECT * FROM (
select trunc(a.RECEIVED_TS) day, to_char(avg(extract(minute from b.RECEIVED_TS - a.RECEIVED_TS)*60 + extract(second from b.RECEIVED_TS - a.RECEIVED_TS)), '999.99') Diff_In_Secs, count(*)
from nps_request a, nps_reply b
where a.id = b.ID
and a.RECEIVED_TS > trunc(sysdate) - 10
and b.target_id is not null
and b.RECEIVED_TS is not null
group by trunc(a.RECEIVED_TS)
order by trunc(a.RECEIVED_TS) desc;
) AS A WHERE A.Diff_In_Secs > 180