开发者

How to calculate the percentage of a column in mysql

I have a table with some number fields an开发者_运维问答d I want to get calculate the percentage of each value in that field. Which means I want to get the sum of the column and divide by it the every row and to multiply by 100. But it doesn't work. Can u help me?


Like this?

select OrderQty * 100.0 / (select sum(OrderQty) from SalesOrderDetail)
from SalesOrderDetail
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜