【发布时间】:2015-03-17 07:59:48
【问题描述】:
我有如下表。考虑查询
select invoice_mth, inv_amt from table xdetails
where mobile_number=9080808080
表格中的数据
mobile_number invoice_mth inv_amt
9080808080 2010-10 20
9080808080 2010-11 30
9080808080 2010-12 40
我必须显示下表中的数据。
我希望发票月份分开每个月和 amt。
MOBILE_NUMBER inv_m1 inv_m2 inv_m3 amt1 amt2 amt3
------- ----------------------------------------------------------
9080808080 2010-10 2010-11 2010-12 20 30 40
要像上面那样显示数据我必须做什么?
【问题讨论】:
-
Stackoverflow 上有很多重要的问题和答案。如果您的情况紧急,您应该阅读this search result set 中的一些主题。主要问题是,您知道要预先旋转的行数吗?还是您需要动态解决方案?
标签: sql oracle oracle11g pivot