是否有像 Oracle SQL 中的 SUM 函数那样的 PRODUCT 函数?

2021-12-06 00:00:00 sql oracle

我有一个同事在找这个,我不记得遇到过这样的事情.

I have a coworker looking for this, and I don't recall ever running into anything like that.

是否有一种合理的技术可以让您模拟它?

Is there a reasonable technique that would let you simulate it?

SELECT PRODUCT(X)
FROM
(
    SELECT 3 X FROM DUAL
    UNION ALL 
    SELECT 5 X FROM DUAL
    UNION ALL
    SELECT 2 X FROM DUAL
)

将产生 30

推荐答案

select exp(sum(ln(col)))
  from table;

如果 col 总是 > 0

if col always > 0

相关文章