Results 1 to 3 of 3

Thread: Select SUM(PTS) FROM TBL

  1. #1
    Join Date
    Dec 1969

    Default Select SUM(PTS) FROM TBL

    If i use select sum(pts) from tbl <BR>how can i write out the answer.<BR>response.write WHAT?<BR>I use <BR>set<BR> "select sum(pts) from tbl "<BR>response.write ????????<BR>rs.close<BR>HELP

  2. #2
    Join Date
    Dec 1969

    Default RE: Select SUM(PTS) FROM TBL

    You can do:<BR>rs(0)<BR><BR>This will get the first column returned (which happens to be sum(pts)). You could also do:<BR><BR>rs.Open "SELECT SumOfPts = sum(pts) from tbl"<BR><BR>if you did that, you could refer to the sum as:<BR>rs("SumOfPts")<BR><BR>Happy Programming!! :)

  3. #3
    Bill Anthony Guest

    Default RE: Select SUM(PTS) FROM TBL

    Greetings to you.<BR><BR>I actually just came across this issue myself a few days ago in a situation I needed to perform SUMs on.<BR><BR>The SQL statement needs to read like so:<BR><BR>sql = "SELECT SUM(PTS) AS someVALUE FROM TBL.... "<BR><BR>The "someVALUE" can be whatever name you&#039d like the container to be named. You have to place the sum of all records with a certain attribute into a container and then call the container later in your code. So, the container name in this case is "someVALUE". When you call it back, you simply write the following:<BR><BR>&#060;%=rs("someVALUE")%&#062;<B R><BR>... and it will display the sum appropriately. I hope this helps you out!<BR><BR>Bill Anthony

Posting Permissions

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