iT邦幫忙

1

ORACLE 語法問題(新手問題)

小弟目前要select出一個報表,但是小弟希望能夠在簡潔一點 如下圖的左圖→到右圖
,有沒有甚麼建議給小弟供小弟參考的謝謝,很謝謝大家的幫忙!!!

看更多先前的討論...收起先前的討論...
qhair1234 iT邦新手 5 級 ‧ 2016-03-18 11:14:42 檢舉
已經補圖謝謝

http://ithelp.ithome.com.tw/upload/images/20160318/2016031811142456eb729041e34_thumb.jpg
圖很小,幾乎無法辨識.
何不用 程式碼 標籤
圖片也太小張了吧~~!
CREATE TABLE
一些測試資料
需要產生的報表樣式
這三個給我們知道一下!才好幫你
賽門 iT邦超人 1 級 ‧ 2016-03-18 12:02:14 檢舉
這是PIVOT的應用吧....
有請小雨大出手調教。
XD
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

1 個回答

2
尼克
iT邦大師 1 級 ‧ 2016-03-18 13:18:07
最佳解答

http://oraclecoder.com/tutorials/three-ways-to-transpose-rows-into-columns-in-oracle-sql--160
網站上面有很好範例,注意: The PIVOT and the UNPIVOT operators were introduced in Oracle version 11g.

Example # 1a: Transpose rows into columns using SUM and DECODE to summarize data
Example # 1b: Transpose rows into columns using MAX and DECODE – for non-summarized data
Example # 2: Transpose rows into columns using the Oracle PIVOT operator
Example # 3: Transpose rows into columns using WITH and sub SELECTS

我要發表回答

立即登入回答