小编jva*_*llo的帖子

将 keepense_rank 从 Oracle 查询转换为 postgres

我正在尝试将以下 Oracle 查询转换为 Postgres

select
        this_.GLOBAL_TRANSACTION_ID as y0_,
        this_.BUSINESS_IDENTIFIER as y1_,
        this_.ENVIRONMENT as y2_,
        count(*) as y3_,
        this_.HOST_NAME as y4_,
        listagg(process,
        ', ') within
    group (order by
        date_time) as process,
        min(this_.DATE_TIME) as y6_,
        max(this_.DATE_TIME) as y7_,
        max(status)keep(dense_rank last
    order by
        date_time,
        decode(status,
        'COMPLETED',
        'd',
        'FAILED',
        'c',
        'TERMINATED',
        'b',
        'STARTED',
        'a',
        'z')) as status
    from
        ACTIVITY_MONITOR_TRANSACTION this_
    where
        this_.DATE_TIME between ? and ?
        and 1=1
    group by
        this_.GLOBAL_TRANSACTION_ID,
        this_.BUSINESS_IDENTIFIER,
        this_.ENVIRONMENT,
        this_.HOST_NAME,
        global_transaction_id,
        business_identifier,
        global_transaction_id,
        business_identifier
    order by
        y7_ asc
Run Code Online (Sandbox Code Playgroud)

问题是我不知道如何转换这个块:

max(status)keep(dense_rank …
Run Code Online (Sandbox Code Playgroud)

oracle postgresql dense-rank

6
推荐指数
1
解决办法
9596
查看次数

标签 统计

dense-rank ×1

oracle ×1

postgresql ×1