Using SQL SUM command

Results 1 to 2 of 2

Thread: Using SQL SUM command

  1. #1
    Bryan Miller Guest

    Default Using SQL SUM command

    Is there a way to use the old SQL "SUM" command to add all the items in a row and return it to a variable. Up to this point everything I have done has used recordsets to return the information and the SUM command doesn&#039t seem to want to return the value to a recordset?

  2. #2
    Join Date
    Dec 1969
    Posts
    2,849

    Default RE: Using SQL SUM command

    &#039We&#039ve already created a connection object named objConn and a recordset object named objRS<BR>Dim strSQL<BR>strSQL = "SELECT PriceSum=SUM(Price) FROM Inventory"<BR><BR>objRS.Open strSQL, objConn<BR><BR>Response.Write "The total price for all items comes to: " & objRS("PriceSum") & "&#060;P>"<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •