Query for crosstab view
问题 I have a table in PostgreSQL like below: -------------------------------------------------------------- Item1 | Item2 | Item3 | Item4 |Value1| Value2| Value3| Value4| -------------------------------------------------------------- I want a query which will show this table like below: ItemHead| ValueHead --------------- Item1 | Value1| --------------- Item2 | Value2| ---------------- Item3 | Value3| ---------------- Item4 | Value4| --------------- 回答1: Use a single SELECT with a LATERAL join to