Posted on 2008-07-21 14:26
lubaolin 阅读(1046)
评论(0) 编辑 收藏 所属分类:
database
SQL> select * from t1;
N1 V1 NID
---------- ---------- ----------
1 aa 61
2 aa 62
3 bb 83
4 aa 64
SQL> select exp(sum(ln(nid))) from t1 where v1='aa';
EXP(SUM(LN(NID)))
-----------------
242048
已用时间: 00: 00: 00.02
验证一下:)
SQL> select 61*62*64 from dual;
61*62*64
----------
242048
已用时间: 00: 00: 00.00
先分组然后求积
SQL> select exp(sum(ln(nid))) from t1 group by v1;
EXP(SUM(LN(NID)))
-----------------
242048
83
oracle 这东东挺有意思.
转自:http://blog.sina.com.cn/s/blog_54eeb5d901000ae5.html