robert__1012 2017-11-30 09:42 采纳率: 0%
浏览 1710

oracle语句改成mysql语句

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

  • 写回答

1条回答

  • akxj2022 2017-11-30 14:03
    关注

    你应该是想排个序,然后加个序号,最后取前十位。
    在mysql里,不需要拼出来一个序号,直接在排序好之后,最后面取第几位到第几位就行了
    例如:
    select * from user order by userName limit 0,10
    这里的limit就是取第0位到第10位

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题