【问题标题】:Oracle Apex Pivot sortingOracle Apex 枢轴排序
【发布时间】:2021-03-30 22:11:55
【问题描述】:

我有一个使用 Pivot 的交互式报告,但我试图按数据透视“年龄组”的行列对报告进行自定义排序,但我做不到。

我需要这种排序的报告:

我该怎么做?

谢谢

【问题讨论】:

    标签: oracle pivot report oracle-apex interactive


    【解决方案1】:

    看起来您想按第一个数字排序,然后按age_group 本身(作为字符串)排序。类似这样的内容(第 1 - 10 行中的示例数据;您可能感兴趣的查询从第 11 行开始):

    SQL> with test (age_group) as
      2    (select 'wahine 45-64'   from dual union all
      3     select 'wahine 25-44'   from dual union all
      4     select 'rangtahi 15-24' from dual union all
      5     select 'pepis 0_4'      from dual union all
      6     select 'pakeke 45-64'   from dual union all
      7     select 'pakeke 25-44'   from dual union all
      8     select 'N/A'            from dual union all
      9     select 'kuia 65+'       from dual
     10    )
     11  select age_group
     12  from test
     13  order by to_number(regexp_substr(age_group, '\d+')), age_group;
    
    AGE_GROUP
    --------------
    pepis 0_4
    rangtahi 15-24
    pakeke 25-44
    wahine 25-44
    pakeke 45-64
    wahine 45-64
    kuia 65+
    N/A
    
    8 rows selected.
    
    SQL>
    

    【讨论】:

      猜你喜欢
      • 2011-08-31
      • 1970-01-01
      • 2010-09-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-12-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多