如何在oracle 10g中添加PIVOT表

时间:2016-12-26 14:49:19

标签: sql oracle oracle10g oracle-sqldeveloper

如何在oracle 10g中添加PIVOT

axios

以下是选择查询之外的

select date,name,count(ID)
from
company
group by date,name

我需要动态地为上面的查询添加PIVOT,将Date添加到列中,命名为Row lobels然后添加ID

Date        Name     Count
---------   ------   -----
22-Dec-16   Create      92
23-Dec-16   Create      61
21-Dec-16   Create     135
26-Dec-16   Insert     241
19-Dec-16   Insert       1
26-Dec-16   Delete       1
18-Dec-16   Delete       1
26-Dec-16   Delete     304
25-Dec-16   Delete       1
21-Dec-16   ALTER        2
24-Dec-16   ALTER        3
25-Dec-16   ALTER        8
20-Dec-16   ALTER        1
23-Dec-16   ALTER        1
26-Dec-16   ALTER      791
19-Dec-16   ALTER        1
15-Dec-16   Modify       4
16-Dec-16   Modify      55
17-Dec-16   Modify      47
19-Dec-16   Modify      85
20-Dec-16   Modify     130
22-Dec-16   Modify     270
18-Dec-16   Modify      89
21-Dec-16   Modify     337
26-Dec-16   Modify    1743
23-Dec-16   Modify     373
24-Dec-16   Modify     766
25-Dec-16   Modify    3012

0 个答案:

没有答案