在乘法(*)运算符而不是+运算符?中有一种聚合值的方法。对于这个例子,结果将是140(4 * 5 * 7 = 140)
SELECT SUM(V) --*?
FROM ( SELECT 4 V
UNION ALL
SELECT 5
UNION ALL
SELECT 7
) Q
答案 0 :(得分:1)
select *
into #a --*?
FROM ( SELECT 4 V
UNION ALL
SELECT 5
UNION ALL
SELECT 7
) Q
select EXP(SUM(LOG(v))) As value from #a
或
SELECT EXP(SUM(LOG(v)))
FROM ( SELECT 4 V
UNION ALL
SELECT 5
UNION ALL
SELECT 7
) Q