SQLServerCentral.com / SQL Server 2005 / SQL Server 2005 General Discussion / Product of Values in a Column / Latest PostsInstantForum.NET v2.9.0SQLServerCentral.comhttp://www.sqlservercentral.com/Forums/notifications@sqlservercentral.comWed, 29 Jul 2015 20:04:03 GMT20RE: Product of Values in a Columnhttp://www.sqlservercentral.com/Forums/Topic612381-149-1.aspxPre-Algebra to the rescue... Thanks!Tue, 02 Dec 2008 14:36:49 GMTbkmooneyRE: Product of Values in a Columnhttp://www.sqlservercentral.com/Forums/Topic612381-149-1.aspxThere's no built-in function that does that. However...Itzik, in his PASS precon, showed a cool trick for faking one using some highschool maths.LOG[sub]x[/sub](a * b * c) = LOG[sub]x[/sub](a) + LOG[sub]x[/sub](b) + LOG[sub]x[/sub](c)So...[code]DECLARE @Test TABLE (val int)INSERT INTO @test VALUES (1)INSERT INTO @test VALUES (2)INSERT INTO @test VALUES (3)INSERT INTO @test VALUES (4)INSERT INTO @test VALUES (5)SELECT POWER(10., SUM(LOG10(val))) FROM @Test [/code]Result: 120Tue, 02 Dec 2008 14:22:32 GMTGilaMonsterProduct of Values in a Columnhttp://www.sqlservercentral.com/Forums/Topic612381-149-1.aspxI am looking for a function that multiplies values in a column the way that the function sum adds them. In MS Excel, this function is called PRODUCT, so I expected there to be a similar function in MS SQL, but can't seem to find it. Any help is greatly appreciated. Thanks =)Tue, 02 Dec 2008 14:04:20 GMTbkmooney