Can someone point me out a function that return the multiplication of all row contents from a column?
It should work like the sum() function, but instead of the summary.. it will return the chain multiplication result. Here is what I need it to do.
x
-------
4
2
3
7
I need a function "multiply" so that when I issued "Select multiply(x) ...group by..." It would return 168 which is 4*2*3*7
I need to do this in DB2, I checked the DB2 UDF, but looks like there is no simple way to create a customized column function like this.
I'll be really appreciated if someone can help.
2 3274
Can someone point me out a function that return the multiplication of all row contents from a column?
It should work like the sum() function, but instead of the summary.. it will return the chain multiplication result. Here is what I need it to do.
x
-------
4
2
3
7
I need a function "multiply" so that when I issued "Select multiply(x) ...group by..." It would return 168 which is 4*2*3*7
I need to do this in DB2, I checked the DB2 UDF, but looks like there is no simple way to create a customized column function like this.
I'll be really appreciated if someone can help.
--------------------------------------------
Reply : select exp(sum(ln(val_ num))) from test_multiply;
select exp(sum(ln(val_ num))) from test_multiply;
It will solve your purpose
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Andy |
last post by:
Hi,
I don't know if this is the correct group to post this, but
when I multiply a huge floating point value by a really
small (non-zero) floating point value, I get 0 (zero) for the result.
This creates a big hole in a 32-bit timer routine I wrote.
Questions.
1. Why does this happen?
2. Is there C macros/functions I can call to tell me
when two non-zero numbers are multiplied and the
|
by: Ralf Hildebrandt |
last post by:
Hi all!
First of all: I am a C-newbie.
I have noticed a "strange" behavior with the standart integer
multiplication. The code is:
void main(void)
|
by: Vijay Kumar R Zanvar |
last post by:
Hi,
Why multiplication of pointers is not allowed?
Till now I only know this, but not the reason why!
PS: As a rule, I searched the FAQ, but could not
find an answer.
--
Vijay Kumar R Zanvar
|
by: Christopher Dyken |
last post by:
Hi group,
I'm trying to implement two routines to handle 32x32-bits and
64x64-bits signed integer multiplication on a 32 bits machine in C. It
easy to find descriptions of non-signed multiplication, however, I
haven't found any good descriptions for the signed counterpart.
Does any of you have a good reference for this topic?
Thanks in advance,
|
by: Paul McGuire |
last post by:
Does Python's run-time do any optimization of multiplication
operations, like it does for boolean short-cutting? That is, for a
product a*b, is there any shortcutting of (potentially expensive)
multiplication operations as in:
if a == 0
return 0
if a == 1
return b
return a*b
| |
by: mjdeesh_hi |
last post by:
How can we perfom multiplication programatically without using + or *
operator.
Can any one help out in this one.
Jagadeesh.
|
by: vkunta |
last post by:
I have situation where table contains data where subset of a data can be linked.
Ex: Col1 COL2
1 2
1 3
3 4
5 8
8 9
Some kind of Daisy Chain situation.
I need sql which will update third column where all rows linked.
|
by: Sozos |
last post by:
Hi guys. I have a problem with writing the base case for the following matrix multiplication function I have implemented. Please help.
#define index(i,j,power) (((i)<<(power))+(j))
void recMultiply(int i, int j, float a, int k, int l, float b, int x, int y, float c, int s);
int i, j, k, s, matrixsize, blocksize, jj, kk, power, bsize;
float sum, maxr, total=0.0, startmult, finishmult, multtime;
float* A = NULL;
float* B = NULL;
|
by: bearophileHUGS |
last post by:
Several languages like Java, C# etc have a List type in the std lib.
Python has a built-in list(), it's implemented as array dynamic on the
right.
Not too much time ago Hettinger has added a collections.deque (its C
code is really nice), that compared to list() allows a faster append
on the right and a much faster prepend on the left. It's implemented
as a double linked list of fixed-sized blocks. All blocks but the
first and last are...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |