Multiply a column

Results 1 to 2 of 2

Thread: Multiply a column

  1. #1
    Bradley Small Guest

    Default Multiply a column

    How do I multiply a column of numbers. Ther is an aggregate function SUM() for adding them, but I need to multiply them all together.<BR><BR>Bradley<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Multiply a column

    I just peeked at the ANSI SQL syntax and didn&#039t see anything obvious.<BR><BR>You could certainly do it in VBScript, though:<BR><BR>&#060;%<BR>Set RS = someConnection.Execute("SELECT theColumn, ... FROM table ...")<BR>product = 1.0<BR>Do Until RS.EOF<BR>&nbsp;&nbsp;&nbsp;&nbsp;... other stuff ...<BR>&nbsp;&nbsp;&nbsp;&nbsp;product = product * RS("theColumn")<BR>&nbsp;&nbsp;&nbsp;&nbsp;... <BR>&nbsp;&nbsp;&nbsp;&nbsp;RS.MoveNext<BR>Loop<BR ><BR>Response.Write "Product of values in the column is " & product<BR>%&#062;<BR><BR>Simple enough, even if it isn&#039t nicely done in SQL?<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts