+ -
当前位置:首页 → 问答吧 → 简单的SQL问题,最大值 最小值的问题

简单的SQL问题,最大值 最小值的问题

时间:2010-08-11

来源:互联网

显示表A中a字段除了的3个最大值 和 2个最小值的其他数
并在最后求平均数.谢谢各位

作者: 20836310   发布时间: 2010-08-11

  1.         select avg(a)
  2.         from (
  3.                 select a
  4.                 from A
  5.                 where a not exists (select max(a) from A where rownum<4)
  6.                 and a not exists (select min(a) from A where rownum<3)
  7.         )
复制代码

作者: cectsky   发布时间: 2010-08-12

回复 cectsky


    正解也。太厉害了。

作者: renxiao2003   发布时间: 2010-08-12