i have a question, How can i pivot an aggregation result to look like ..
I'm trying to pivot a simple aggregation using this query first:
select sync_action action, count(sync_action) total
FROM my_table
group by sync_action
and to pivot the table i'm using:
select * from (
select sync_action , count(sync_action) total
FROM my_table
group by sync_action )
pivot
(
count(sync_action)
for sync_action in ('delete','create')
)
;
and i don't know where is the error, because the result is:
the idea is have the same as the first image.
Can somebody help me?
Best regards
I would just use conditional aggregation: