Using SUM Function in An SQL Statement
Vote this news:
Sum function can be used for to get the sum of a numeric expression evaluated over a set. This function must be placed in an SQL statement. Following example will return the sum of ratings in articles.
In this example we have used our old database. There was a rating column holding the votes of our articles. We were using this simple script to check sum of ratings.
Set cn = server.createobject("adodb.connection")
cn.open strCon
set rs = cn.execute("select SUM(rating) from articles")
response.write rs(0)
rs.close
set rs = nothing
no comments submitted

