当前位置:   article > 正文

oracle分组统计group,分页查询limit_oracle 分页获取数据 limit

oracle 分页获取数据 limit

oracle分组查询GROUP BY

SELECT money,count(1) FROM a.S_ELOG 
WHERE CREATEDATE>=TO_DATE('2022-10-24 00:00:00','yyyy-mm-dd hh24:mi:ss') 
AND CREATEDATE<TO_DATE('2022-10-25 00:00:00','yyyy-mm-dd hh24:mi:ss') 
GROUP BY money;
  • 1
  • 2
  • 3
  • 4

oracle分页查询ROWNUM

SELECT * FROM ( 
SELECT a. * ,ROWNUM FROM ( 
SELECT ID,TYPE FROM S_ELOG WHERE TYPE = 1 OR TYPE IS NULL ORDER BY ID ASC ) a 
WHERE ROWNUM <= 20 ) WHERE ROWNUM > 0
  • 1
  • 2
  • 3
  • 4

oracle按分钟分组,取总数最大的100条

SELECT * FROM  
(SELECT A.*, ROWNUM RN  FROM (
SELECT TO_CHAR(CREATEDATE,'yyyy-mm-dd hh24:mi') AS createdate,SUM(money) AS total FROM a.S_ELOG 
GROUP BY TO_CHAR(CREATEDATE,'yyyy-mm-dd hh24:mi') ORDER BY total DESC
) A  WHERE ROWNUM <= 100)  
WHERE RN > 0;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/268567
推荐阅读
相关标签
  

闽ICP备14008679号