Skip to content

Tag: pivot

SQL pivot query to get the result in a single row

I have a users table as I have another user_custom_fields table as and a third custom_fields table Here the problem is I need the result for each user in a single row with all the custom field_name as column header as I have heard about pivot queries but I don’t have much knowledge of SQL. Can anyone he…

sql: long to wide format without using PIVOT

I have a table like the following: I want to convert the data to wide format like the following: the SQL I used does not have a pivot choice so I am wondering how to convert the long format to wide without using PIVOT. Answer If I understand your question correctly, you can do conditional aggregation: Maybe y…