![]() |
1
2
莎拉, 以下是示例数据:
查询:
要了解它的工作原理,请从内到外执行查询并检查中间结果集。如果你需要更多的解释,请告诉我。 罗伯。 |
![]() |
2
0
|
![]() |
3
0
我的测试数据(借用Rob): create table mytable (id,state,state_time) as select 1, 'New', to_date('2009-03-03 00:03:31','yyyy-mm-dd hh24:mi:ss') from dual union all select 1, 'Closed', to_date('2009-03-04 04:15:27','yyyy-mm-dd hh24:mi:ss') from dual union all select 2, 'New', to_date('2010-05-22 14:38:49','yyyy-mm-dd hh24:mi:ss') from dual union all select 2, 'Open', to_date('2010-05-22 14:39:14','yyyy-mm-dd hh24:mi:ss') from dual union all select 2, 'Fixed', to_date('2010-05-22 17:15:27','yyyy-mm-dd hh24:mi:ss') from dual union all select 3, 'New', date '2009-01-01' from dual union all select 3, 'Open', date '2009-01-02' from dual union all select 3, 'Fixed', date '2009-01-03' from dual union all select 3, 'Open', date '2009-01-04' from dual union all select 3, 'Fixed', date '2009-01-05' from dual union all select 3, 'Closed', date '2009-01-06' from dual
查询结果: ID NEW_IN NEW_OUT OPEN_IN OPEN_OUT CLOSE_IN CLOSE_OUT 1 3/3/2009 12:03:31 3/4/2009 4:15:27 3/4/2009 4:15:27 2 5/22/2010 2:38:49 5/22/2010 2:39:14 5/22/2010 2:39:14 5/22/2010 5:15:27 3 1/1/2009 1/2/2009 1/2/2009 1/3/2009 1/6/2009
|
|
B.Poe · 在熊猫数据透视表中显示映射标签而不是代码 7 年前 |
|
brendxn · 如何在数据帧中透视一个包含字符串的列?[副本] 7 年前 |
![]() |
Anif Maulana · 在postgres中从两个不同的列中划行 7 年前 |
![]() |
Cindy · 为困难的数据集python创建数据透视表 7 年前 |
![]() |
Newskooler · 如何创建熊猫数据透视表 7 年前 |
|
K.R. · Excel数据透视表日期筛选器[关闭] 7 年前 |