【问题标题】:Max and Selection of multiple columns in the same Query Oracle同一个Query Oracle中多列的Max和Selection
【发布时间】:2017-07-09 11:46:35
【问题描述】:

谁能告诉我如何在 oracle 中实现这个查询

select column1, columns2, max(rownumber) from table where .....;

说明:Select Query 非常复杂,我需要 max 给 UI 端记录的“总计数”以进行分页,我将根据分页大小而不是完整记录仅发送 20 或 30 条记录。

【问题讨论】:

标签: sql oracle


【解决方案1】:

使用窗口函数:

select column1, columns2, 
       count(*) over () as total_count
from table 
where .....;

【讨论】:

    猜你喜欢
    • 2021-02-18
    • 2021-04-18
    • 2016-07-19
    • 2022-01-13
    • 1970-01-01
    • 2015-03-05
    • 1970-01-01
    • 1970-01-01
    • 2012-08-02
    相关资源
    最近更新 更多