Popular Articles | Latest Articles | Categories | RSS Feeds

Login  |  Register

Using SUM Function in An SQL Statement

Published on 8/7/2008 by Site Editor
 Vote this tutorial:

More articles in ASP

 

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.

Latest Posts

Active News Manager - news management system



ASP.NET Resources, Reviews

ASP Resources, Reviews

PHP, ASP, .NET, JSP Resources, Reviews




Who's online

  • There 108 online users.

ASP.NET Resources, Reviews

ASP Resources, Reviews

PHP, ASP, .NET, JSP Resources, Reviews

Hotscripts.com Free Photoshop, Flash and 3DS MAX tutorials