需要用rownum和order by时可以用两层select进行查询
select *
    from(select rownum rn, a.* from
    (select DISTINCT c.name AS cname, NVL(sum(oi. money),0) AS sumMoney
                from (orders o inner join customers c on o.customer_id=c.id)
                 left join order_items oi
                  on o.id=oi.order_id
                     where   '1'='1'   
                         group by c.name
                           order by sumMoney desc
      ) a)
    where RN >  0 and RN < 4

相关文章:

  • 2021-06-20
  • 2022-12-23
  • 2022-12-23
  • 2021-09-26
  • 2022-12-23
  • 2022-02-10
  • 2021-10-01
  • 2021-05-23
猜你喜欢
  • 2021-07-23
  • 2021-06-04
  • 2021-10-31
  • 2022-12-23
  • 2022-02-10
  • 2021-08-08
  • 2022-12-23
相关资源
相似解决方案