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
Post a Comment