用分析函数 统计某商店的营业额。 date sale 1 20 2 15 3 14 4 18 5 30 规则:按天统计:每天都统计前面几天的总额 得到的结果: DATE SALE SUM ----- -------- ------ 1 20 20 --1天 2 15 35 --1天+2天 ...
Oracle中ROWNUM的使用技巧 作者: fuyuncat 来源: www.HelloDBA.com ROWNUM是一种伪列,它会根据返回记录生成一个序列化的数字。利用ROWNUM,我们可以生产一些原先难以实现的结果输出,但因为它是伪列的这个特殊性,我们在使用时也需要注意一些事项,不要掉入“陷阱”。下面就介绍一下它的使用技巧及注意事项。 1 特殊结果输出 利用ROWNUM,我们可以做到一些特殊方式的输出。 1.1 Top N结果输出 我们如果希望取输出结果的前面几条数据,通过ROWNUM可以轻松实现: SQL> select * from t_tes ...
  • 10:52
  • 浏览 (70)
  • 评论 (0)
  • 分类: DB
ROWNUM For each row returned by a query, the ROWNUM pseudocolumn returns a number indicating the order in which Oracle selects the row from a table or set of joined rows. The first row selected has a ROWNUM of 1, the second has 2, and so on. You can use ROWNUM to limit the number of rows returned b ...
  • 09:35
  • 浏览 (69)
  • 评论 (0)
  • 分类: DB
seasar
搜索本博客
最近加入圈子
存档
最新评论