'PostgreSQL: Flip Rows and Columns
I have a PosgreSQL table called store_properties.
SELECT * FROM store_properties
provides this data, which has hundreds of rows returned:
| name | value | last_modified_on |
|---|---|---|
| address | 123 Main St | 2022-03-23 16:05:04 |
| city | Cityville | 2022-03-23 16:05:04 |
| state | AL | 2022-03-23 16:05:04 |
| ... | ... | ... |
I need to write a query that returns the name field as the column aliases and value as the fields with just 1 row. Example:
| address | city | state | ... |
|---|---|---|---|
| 123 Main St | Cityville | AL | ... |
How can this be done? I do not have access to create functions or add plugins.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
