赞
踩
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;
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
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;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。