Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
182 views
in Technique[技术] by (71.8m points)

sql server 2016 - Multiplication with SQL

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...