3 ms·
I was surprised that MySQL lacked a Product() aggregate function with its GROUP BY. After much searching I came to this little nugget: "exp(sum(log(coalesce(t
by physcab 17y ago
I was surprised that MySQL lacked a Product() aggregate function with its GROUP BY.
After much searching I came to this little nugget:
"exp(sum(log(coalesce(the field you want to multiply,1)))
The coalesce() function is there to guard against trying to calculate the
logarithm of a null value and may be optional depending on your
circumstances."
MySQL is full of hacks.