select 批次号,max(销售次数),厂商号 from table_name  group by 批次号,厂商号 怎么样设置返回的条数呀??晕 oracle里面没有 limit这个东西 ..而且我上面使用了聚合函数;

解决方案 »

  1.   

    select 批次号,max(销售次数),厂商号 from table_name  group by 批次号,厂商号  limit 10,15 
    这个是mysql的用法
      

  2.   

    select * from 
    (select 批次号,max(销售次数)销售次数,厂商号 ,rownum rn from table_name  group by 批次号,厂商号) t 
    where rn between 10 and 15 
      

  3.   


    报错..
    rownum rn  不是group by 表达式 
    如果改成
    select * from 
    (select 批次号,max(销售次数)销售次数,厂商号 ,rownum rn from table_name  group by 批次号,厂商号,rownum) t 
    where rn between 10 and 15 
    的话 就查不出来那个max(销售次数)了...
      

  4.   

    改为以下行吗:
    select * from 
    (select 批次号,max(销售次数)销售次数,厂商号 ,max(rownum) from table_name  group by 批次号,厂商号) t 
    where rn between 10 and 15