SELECT * FROM
(
SELECT trunc(start_ts) ,STATUS
FROM table1
)
PIVOT (
COUNT(STATUS) FOR STATUS in ('ERROR' error, 'COMPLETED' Completed)
);
答案 0 :(得分:0)
条件start_ts > sysdate-30
会将start_ts限制为持续30天。
SELECT * FROM
(
SELECT trunc(start_ts) ,STATUS
FROM table1 where start_ts > sysdate-30
)
PIVOT (
COUNT(STATUS) FOR STATUS in ('ERROR' error, 'COMPLETED' Completed)
);