I try to create an aggregate for product (*) in PostgreSQL. The field type of my row is "double precision"
So, I tried :
CREATE AGGREGATE nmul(numeric)
(
sfunc = numeric_mul,
stype = numeric
);
When I launch my query, the result :
ERROR: function nmul(double precision) does not exist
LINE 4: CAST(nmul("cote") AS INT),
Thank you
I found a solution from a very smart guy, who realized you can use logarithms to achieve this (credit goes to him):
select exp(sum(ln(x))) from generate_series(1,5) x;
exp
-----
120
(1 row)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With