I want to multiply the values in ID column of mytable :
ID
1
2
3
4
I am using the SQL query as below:
SELECT EXP(SUM(LOG(ID))) as result
from dbo.mytable with (nolock)
Any other ways to calculate the multiplication of ID values, Please share.
I want to multiply the values in ID column of mytable :
ID
1
2
3
4
I am using the SQL query as below:
SELECT EXP(SUM(LOG(ID))) as result
from dbo.mytable with (nolock)
Any other ways to calculate the multiplication of ID values, Please share.
You can do It simply by declaring an variable
DECLARE @MulVal INT SELECT @MulVal = Id * COALESCE(@MulVal, 1) FROM #Tbl SELECT @MulVal