How to perform row wise math operations in SQL Server? -


how perform row wise math operations in sql server?

eg: want find average of marks particular student shown in table below

student     mark1   mark2   mark3   avg ----------------------------------------------- ram         78       81      56     71.67 jos         92       67      54     71.00 saj         98       91      89     92.67 

select student, mark1, mark2, mark3, 1.0 * (mark1 + mark2 + mark3)/3 avg yourtable 

add 1.0 * convert sum result float before division


Comments

Popular posts from this blog

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -