If I have a dataset in SQL like this:
ColA ColB ColC ColD ColE
4 8 9 1 10
How do I multiply each column value together but by indexing rather then typing out the column names such as:
1:number_of_columns(dataset)
Multiply all values together
The reason I want to index this is because the number of columns will not always be the same length and indexing this dataset would solve this problem in a dynamic fashion.
Final Output:
ColA ColB ColC ColD ColE Total
4 8 9 1 10 2,880
This final code though should be able to solve a dataset even like this:
ColE ColG ColD
45 33 44
Result:
ColE ColG ColD Total
45 33 44 65,340