Popular Articles | Latest Articles | Categories | RSS Feeds


Using SUM Function in An SQL Statement

by Site Editor Published 8/7/2008 | ASP |
 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

Comments:
no comments submitted


Only members can write comments.Please, login / register to write comment.




ASP.NET Resources, Reviews

ASP Resources, Reviews

PHP, ASP, .NET, JSP Resources, Reviews


Search

Member login


Who's online

  • There 28 online users.