I need to create a column in an SQL query which is calculated from data in 3 other columns. Each of the columns contain a whole number which is a score for a particular exam. The existing columns are:
EnglishResults.intMark
MathsResults.intMark
NVRResults.intMark
The single weighted column needs to multiply the EnglishResults.intMark by 0.5, multiply the MathsResults.intMark by 0.35, multiply the NVRResults.intMark by 0.15 and then add the 3 resulting multiplied numbers together.
For example is the EnglishResults.intMark is 300, MathsResults.intMark is 200 and NVRResults.intMark is 100 the resulting weighted value will be 235 (300 *0.5 = 150, (+) 200 * 0.35 = 70, (+) 100 * 0.15 = 15)
I cannot get my head around how to make this work in SQL so any assistance would be greatly appreciated.
question from:
https://stackoverflow.com/questions/65902543/multiplication-with-sql 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…