is there a PRODUCT function like there is a SUM function in Oracle SQL?

后端 未结 6 1826
别跟我提以往
别跟我提以往 2020-12-03 04:15

I have a coworker looking for this, and I don\'t recall ever running into anything like that.

Is there a reasonable technique that would let you simulate it?

6条回答
  •  生来不讨喜
    2020-12-03 04:26

    There are many different implmentations of "SQL". When you say "does sql have" are you referring to a specific ANSI version of SQL, or a vendor specific implementation. DavidB's answer is one that works in a few different environments I have tested but depending on your environment you could write or find a function exactly like what you are asking for. Say you were using Microsoft SQL Server 2005, then a possible solution would be to write a custom aggregator in .net code named PRODUCT which would allow your original query to work exactly as you have written it.

提交回复
热议问题