Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想将两列上的值相乘……一列名为“点”,另一列名为“单位”。我实际上想将两列上的值相乘,然后将相乘值的总和相加。我该怎么做?
只需在和SUM()的乘积上使用聚合pointunit
SUM()
point
unit
SELECT SUM(point * unit) total FROM Table1
这是SQLFiddle演示
I hope you lookin something like this.. SELECT sum(total) FROM ( SELECT col1 * col2 AS total FROM your_table tbl1 ) tbl2