-1
A
回答
1
这实际上是一个非支点,没有支点
select year, week, 'loading' as area, loading as value
from the_table
union all
select year, week, 'picking', picking
from the_table
union all
select year, week, 'painting', painting
from the_table
+0
非常感谢你..救了我 – Anshul
0
如果只有3,您需要转动柱子,然后用union
select year,week,'loading' as aread,loading as val from tbl
union all
select year,week,'painting' as area,painting as val from tbl
union all
select year,week,'picking' as area,picking as val from tbl
如果列的数量是动态的,那么我建议你使用动态数据透视表。
Dynamic pivot query using PostgreSQL 9.3
http://www.cureffi.org/2013/03/19/automatically-creating-pivot-table-column-names-in-postgresql/
+0
谢谢你Utsav – Anshul
相关问题
- 1. 如何Postgres的
- 2. 如何在Postgres的
- 3. 如何在Postgres的
- 4. 如何Postgres的9
- 5. 如何从Postgres的功能
- 6. 如何检查的Postgres里
- 7. 如何使用Postgres的
- 8. 如何“名称”中的Postgres
- 9. 如何调用Postgres的
- 10. 如何查询postgres的UUID
- 11. 如何创建与Postgres的
- 12. 如何插入'到postgres?
- 13. 如何解析了在Postgres
- 14. 如何设置Postgres扩展?
- 15. 如何保持jdbc postgres alive
- 16. 如何去除postgres中的大对象
- 17. 的Postgres如何保持使用CTE
- 18. Postgres的序列如何被打破?
- 19. 如何计算Postgres中的json数据
- 20. Postgres:如何获得多列的聚合
- 21. 如何获得调试postgres的权限?
- 22. 的Postgres 8.4.3:如何使用UNNEST
- 23. 如何Postgres的执行批量插入
- 24. 如何使用派生表中的Postgres
- 25. 如何删除postgres中的约束?
- 26. 如何替换postgres中的表格?
- 27. Postgres的:如何从同一个表
- 28. 如何实现SQL(Postgres的)优先
- 29. 如何删除Postgres的扩展
- 30. Postgres的 - 如何检查空数组
http://meta.stackoverflow.com/questions/285551/why-may-i-not-upload-images-of-code-on-so-when-asking - 问题/ 285557#285557 –