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

SVG stroke-linecap doesn't work for circles in Firefox? -

routes - Laravel 4 Wildcard Routing to Different Controllers -

cross browser - XSLT namespace-alias Not Working in Firefox or Chrome -