找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 3758|回复: 2

分页加排序

[复制链接]

300

主题

35

回帖

1582

积分

管理员

积分
1582
发表于 2024-10-6 09:00:30 | 显示全部楼层 |阅读模式
select ROWNUM RN,KK.*from

(
select  PAY_ACCNO as 帐号, PAY_ACCNAME  as 户名 , TRANS_AMT as 交易金额, CUR_AMT as  当前余额,
decode(TRANS_TP,  '01','转账入金',  '02','退汇',  '03','支付渠道入金',  '04','提现',  '05','退款-(预留)',  '06','其它')   as 交易类型,
TSTM as 时间戳,
decode(C_D_FLAG,  'C','帐户入金',  'D','帐户出金')  as 资金方向,
    TRANS_DT as 交易日期, TRANS_TM as 交易时间, REMARK as 备注,
  DIGEST as 摘要, USER_NM as 用户名称, USER_ID as 用户编号, JRNO as 日志号, REARK1 as 备用字段1, REARK2 as 备用字段2, REARK3 as 备用字段3, updatetime as 上传时间
, count(1) over(partition by 1) total
  from hd40.LJTransaction  where 1=1   
   and TSTM >= to_date('20241001 00:00:00', 'yyyy-MM-dd HH24:mi:ss')
   and TSTM <= to_date('20241001 23:59:59', 'yyyy-MM-dd HH24:mi:ss')
and   C_D_FLAG like '%%'    order By TSTM ASC
) KK

where ROWNUM between  1 and 10

300

主题

35

回帖

1582

积分

管理员

积分
1582
 楼主| 发表于 2024-10-6 09:02:59 | 显示全部楼层
select KK.*,ROWNUM RN from

(
select  PAY_ACCNO as 帐号, PAY_ACCNAME  as 户名 , TRANS_AMT as 交易金额, CUR_AMT as  当前余额,
decode(TRANS_TP,  '01','转账入金',  '02','退汇',  '03','支付渠道入金',  '04','提现',  '05','退款-(预留)',  '06','其它')   as 交易类型,
TSTM as 时间戳,
decode(C_D_FLAG,  'C','帐户入金',  'D','帐户出金')  as 资金方向,
    TRANS_DT as 交易日期, TRANS_TM as 交易时间, REMARK as 备注,
  DIGEST as 摘要, USER_NM as 用户名称, USER_ID as 用户编号, JRNO as 日志号, REARK1 as 备用字段1, REARK2 as 备用字段2, REARK3 as 备用字段3, updatetime as 上传时间
, count(1) over(partition by 1) total
  from hd40.LJTransaction  where 1=1   
   and TSTM >= to_date('20241001 00:00:00', 'yyyy-MM-dd HH24:mi:ss')
   and TSTM <= to_date('20241001 23:59:59', 'yyyy-MM-dd HH24:mi:ss')
and   C_D_FLAG like '%%'    order By TSTM ASC
) KK

where ROWNUM between  1 and 10

300

主题

35

回帖

1582

积分

管理员

积分
1582
 楼主| 发表于 2024-10-6 11:16:44 | 显示全部楼层

select* from (
select KK.*,ROWNUM RN from
  (

  select  PAY_ACCNO as 帐号, PAY_ACCNAME  as 户名 , TRANS_AMT as 交易金额, CUR_AMT as  当前余额,
decode(TRANS_TP,  '01','转账入金',  '02','退汇',  '03','支付渠道入金',  '04','提现',  '05','退款-(预留)',  '06','其它')   as 交易类型,
TSTM as 时间戳,
decode(C_D_FLAG,  'C','帐户入金',  'D','帐户出金')  as 资金方向,
    TRANS_DT as 交易日期, TRANS_TM as 交易时间, REMARK as 备注,
  DIGEST as 摘要, USER_NM as 用户名称, USER_ID as 用户编号, JRNO as 日志号, REARK1 as 备用字段1, REARK2 as 备用字段2, REARK3 as 备用字段3, updatetime as 上传时间
, count(1) over(partition by 1) total
  from hd40.LJTransaction  where 1=1   
   and TSTM >= to_date('20241001 00:00:00', 'yyyy-MM-dd HH24:mi:ss')
   and TSTM <= to_date('20241001 23:59:59', 'yyyy-MM-dd HH24:mi:ss')
and   C_D_FLAG like '%%'    order By TSTM ASC



) KK )
  where RN between  2 and 10







您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|久要宝盒 ( 皖ICP备18021237号 )

GMT+8, 2025-5-5 20:20 , Processed in 0.064323 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表