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
精彩评论