Skip to content
Advertisement

Tag: pivot

PIVOT with 3 tables and JOIN without number values

Hope someone can help me or point me to the right direction. I’m more of a beginner in sql language. I have 3 table users, dataTypes and usersData I only managed to use join on three tables like this: That gets all the entries for every single user like this and then repeating multiple times the same user id: However

2 column with 2 different condition in one table

is it possible to create a query that will output 2 column with 2 different WHERE clause this my ideal output: where count 1 is the result of the 1st WHERE clause. Which I already created. What I want is to have another column where in the value will be with different WHERE clause. here’s my query: with this query

Presto – pivot table

Hi I have a table like this: I want to convert it into like this: Answer For a fixed list of properties, you can do conditional aggregation: This puts the session id in the first column and 0/1 values in each column, depending on whether the given session owns the given property. To generate the exact output you showed (which

Making a pivot table group by users

I want to see user statics, so I made query: It’s working. Here is the result: 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 ? Answer Consider adding the month expression, TRUNC(l.datum_p,’MONTH’), into above aggregate query. Then run the query

Advertisement