SQL 将一列的值除以另一列

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8257106/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-01 13:23:29  来源:igfitidea点击:

divide the value of a column by another column

sqlsql-function

提问by Sheik Syed Mohaideen

I want to divide a value of a column by the value of another column and display the result as separate column

我想将一列的值除以另一列的值并将结果显示为单独的列

ex:

前任:

project name             total-percent        no.of screen
------------            --------------        -------------
pro-1                     150                     5
pro-2                      50                     3

now i want to divide total-percent by no.of screen and display the result in another column

现在我想将总百分比除以屏幕数量并将结果显示在另一列中

回答by Mahmoud Gamal

Select total_percent / no_of_scren as 'result' From yourTableName