Get rows product (multiplication)

后端 未结 3 680
清歌不尽
清歌不尽 2020-12-19 02:07

SO,

The problem

I have an issue with rows multiplication. In SQL, there is a SUM() function which calculates sum for some field

3条回答
  •  囚心锁ツ
    2020-12-19 03:03

    I guess this would work...

    SELECT IF(MOD(COUNT(data < 0),2)=1
            , EXP(SUM(LOG(data)))*-1
            , EXP(SUM(LOG(data))))
              x 
      FROM my_table;
    

提交回复
热议问题