IDPLANSOS|IDBUT|PLANSOSDATEST |
---------+-----+-----------------------+
37| 1|2022-08-31 16:04:34.000|
34| 1|2022-08-31 15:14:32.000|
39| 2|2022-09-01 08:16:23.000|
40| 3|2022-09-01 08:20:09.000|
44| 2|2022-09-01 15:20:23.000|
48| 1|2022-09-02 09:12:22.000|
53| 2|2022-09-02 11:09:06.000|
64| 2|2022-09-05 09:10:20.000|
66| 2|2022-09-05 09:46:05.000|
70| 2|2022-09-05 10:27:01.000|
SELECT *
FROM (SELECT IDBUT,
TRUNC(PAC.PLANSOSDATEST) PLANSOSDATEST,
IDPLANSOS
FROM PA_ANDON_CALLS PAC)
PIVOT (SUM(IDPLANSOS) FOR PLANSOSDATEST IN (TO_DATE('2022-08-31', 'YYYY-MM-DD') AS "2022-08-31",
TO_DATE('2022-09-01', 'YYYY-MM-DD') AS "2022-09-01",
TO_DATE('2022-09-02', 'YYYY-MM-DD') AS "2022-09-02",
TO_DATE('2022-09-05', 'YYYY-MM-DD') AS "2022-09-05"))