General information
Title:
How to display SQL compute value
I have a table which I would like to display along with the sum of certain columns:
office code amnt
------ ---- ------
manila 1000 12
manila 1000 22
manila 1001 24
manila 1000 53
i have this code:
< %
qry = "select office,code,'ntotal' = sum(amnt) from web_test where"
qry = qry & " office = 'manila' group by office, code"
qry = qry & " order by office, code compute sum(sum(amnt))"
Response.Write qry
set rs = server.createobject("ADODB.Recordset")
rs.open qry,"DSN=cmts_sql;UID=sa"
while not rs.EOF
Response . Write rs("office") & " " & rs("code") & " " & rs("ntotal") & " < br > "
rs.MoveNext
wend
% >
This results in:
manila 1000 87
manila 1001 24
But this does not display the compute sum(sum(amnt)). How do i display it? I plan to use that sum(sum(amnt)) and assign it to a variable because the table is going to be very long (about 100,000 records). I plan to use ADO's pagecount,pagesize properties to display the contents of the table in pages and at the same time displaying the subtotal and grandtotal of amnt always.
Thanks for the help :)
Ramon Carlos
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only