Skip to content

SQL Multiplication Witout a Cursor

Introduction

In this quick tip we will illustrate how you can multiply rows in a table together without using a cursor.

The SQL for this is not particularly difficult but the results are really useful.

Examples

The following sample illustrates creating a table, adding 3 values to that table using a table constructor, and then using the simple algorithm EXP(SUM(LOG(<>))) to multiply all three values together; 2 x 3 x 4 = 24.