Multiply a Column

## Multiply a Column

I need to be able to multiply a column in a database such that I can update a field in a different tabel with the results. I am looking for somethign like Avg() or Sum(). <BR><BR>It is being used to statistical analysis and quantitavive forecasting, so I need to avoid cursors where possible.

2. Senior Member
Join Date
Dec 1969
Posts
1,435

## RE: Multiply a Column

Most RDBMS can do arithmetic in a SQL statement - eg SELECT (column_name * 3) AS times_3 FROM...<BR><BR>Dunc

## RE: Multiply a Column

Dunc --<BR><BR>Yes, I am aware that I can multiply a column * 3. The question was how do I multiply a whold column of values. I have a table full of factors, and I want to multiply each of them in turn against the previous resultant value to update the column. <BR><BR>I want to do it like SUM() but multiplying instead.<BR><BR>Bradley

4. Senior Member
Join Date
Dec 1969
Posts
1,435

## RE: Multiply a Column

But SUM() is an *aggregating* function - do you actually want to aggregate all the values in a column? Or just multiply one column by another?<BR><BR>Dunc

## RE: Multiply a Column

Dunc -<BR> Now you understand!!! Yes, I want to aggregate all the factors by multiplying them together. <BR><BR>The idea is each row contains a quantitative adjustment factor. Thre are an unknown number of them, so I want to multiply all of them together to get a value which I will multiply against a base value.<BR><BR>Bradley<BR><BR><BR>--Dunc Said --<BR>But SUM() is an *aggregating* function - do you actually want to aggregate all the values in a column? Or just multiply one column by another?<BR><BR>Dunc

6. Senior Member
Join Date
Dec 1969
Posts
1,435

## RE: Multiply a Column

Argh!<BR><BR>Write a stored procedure!<BR><BR>Dunc