Skip to content
Advertisement

Making a pivot table group by users

I want to see user statics, so I made query:

It’s working. Here is the result:

https://i.stack.imgur.com/WSc0f.png

But I want to make a pivot by Months (last 6 months)…

Table: obj_odb_l l ->date column -> l.datum_p -> trunc(l.datum_p,’MONTH’)

How can I make a pivot table ?

Advertisement

Answer

Consider adding the month expression, TRUNC(l.datum_p,'MONTH'), into above aggregate query. Then run the query as another CTE in pivot query for JOIN in pivot’s data source.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement