SELECT
main.*
FROM
(
SELECT
a.gain_rebate_order_bt_seq,
a.rebate_order_internal_code,
a.create_time,
a.rebate_order_pay_amt,
a.biz_mobiz_company_bd_seq,
a.biz_mobiz_shop_bd_seq,
a.user_user_base_sb_seq,
a.mobiz_company_internal_code,
a.mobiz_shop_internal_code,
a.vmall_bind_account,
a.user_base_alais_name,
a.rebate_order_status_itype,
a.mobiz_company_name,
a.mobiz_shop_name,
a.shop_fee_operator_itype,
row_number()over(ORDER BY a.create_time DESC)rowno,
fun_get_account_name(
a.rebate_order_internal_code
)AS homeAccount,
f.order_pay_amt payIngot,
f.order_pay_status_itype ingotPayType,
g.order_pay_amt payCash,
g.order_pay_status_itype cashPayType,
a.currency_rate_symbol operatorTypeStr,
h.order_pay_amt payPoint,
h.order_pay_status_itype pointPayType
FROM
gain_rebate_order_bt a
LEFT JOIN gain_order_pay_bt f ON a.gain_rebate_order_bt_seq = f.gain_rebate_order_bt_seq
AND f.order_pay_do_itype = 1
AND f.order_pay_pmethod_itype = 4
LEFT JOIN gain_order_pay_bt g ON a.gain_rebate_order_bt_seq = g.gain_rebate_order_bt_seq
AND g.order_pay_do_itype = 1
AND g.order_pay_pmethod_itype IN(1, 2, 3)
LEFT JOIN gain_order_pay_bt h ON a.gain_rebate_order_bt_seq = h.gain_rebate_order_bt_seq
AND h.order_pay_do_itype = 1
AND h.order_pay_pmethod_itype = 5
WHERE
a.active_flag = 'y'
)main
WHERE
main.rowno BETWEEN 0
AND 10
你应该是想排个序,然后加个序号,最后取前十位。
在mysql里,不需要拼出来一个序号,直接在排序好之后,最后面取第几位到第几位就行了
例如:
select * from user order by userName limit 0,10
这里的limit就是取第0位到第10位