Pivot Tables in PostgreSQL Using the Crosstab Function
https://learnsql.com/blog/creating-pivot-tables-in-postgresql-using-the-crosstab-function/
Our Initial Point: Raw DataOur Target: A Pivot TableEnabling The Crosstab FunctionHow The Crosstab Function WorksOne Raw Data Set, Many Pivot TablesThe crosstabfunction receives an SQL SELECT command as a parameter, which must be compliant with the following restrictions: 1. The SELECT must return 3 columns. 2. The first column in the SELECT will be the identifier of every row in the pivot table or final result. In our example, this is the student's name. Notice how students' names (John Smith...See more on learnsql.comPublished: May 19, 2016Author: Maria Al…Estimated Reading Time: 6 mins The crosstabfunction receives an SQL SELECT command as a parameter, which must be compliant with the following restrictions: 1. The SELECT must return 3 columns. 2. The first column in the SELECT will be the identifier of every row in the pivot table or final result. In our example, this is the student's name. Notice how students' names (John Smith...
The crosstabfunction receives an SQL SELECT command as a parameter, which must be compliant with the following restrictions: 1. The SELECT must return 3 columns. 2. The first column in the SELECT will be the identifier of every row in the pivot table or final result. In our example, this is the student's name. Notice how students' names (John Smith...
DA: 57 PA: 83 MOZ Rank: 42