AVG function in SQL

Results 1 to 2 of 2

Thread: AVG function in SQL

  1. #1
    Rob Guest

    Default AVG function in SQL

    Can someone tell me how to do this properly<BR><BR>SQL = "SELECT AVG(score),score FROM TBLData GROUP BY score"<BR>set rs = adoConn.execute(SQL)<BR><BR>This works fine however I want to print this average. When<BR>I try to like this<BR>response.write rs("score")<BR><BR>it gives me the exact score and not the average.<BR>How do I write the average?<BR><BR>Thanks,<BR><BR>ROb<BR><BR>

  2. #2
    geeoff Guest

    Default RE: AVG function in SQL

    SQL = "SELECT AVG(score) AS the_avg_score, score FROM TBLData GROUP BY score"<BR>set rs = adoConn.execute(SQL)<BR><BR>response.write rs("the_avg_score")<BR><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