Forums
This topic is locked
Adding and displaying the sum of a column.
Posted 15 Jul 2002 12:35:49
1
has voted
15 Jul 2002 12:35:49 Russell Marshall posted:
How do I add up numbers returned from a recordset. I want to display the results in a repeat region column and display the sum at the bottom. Replies
Replied 15 Jul 2002 13:08:36
15 Jul 2002 13:08:36 Julio Taylor replied:
please post the SQL query you're using to display the repeat region.
------------------------
Poolio
MSN:
www.eliziumdesign.com
------------------------
Poolio
MSN:
www.eliziumdesign.com
Replied 15 Jul 2002 13:25:28
15 Jul 2002 13:25:28 Russell Marshall replied:
Infor from UD Record set
SELECT *
FROM products
WHERE prodgroup = 'MMColParam'
MMColParam * Request.QueryString("mnu_product"
mnu_product is the text box from a search form.
This is the ASP.
<%
set RS_List = Server.CreateObject("ADODB.Recordset"
RS_List.ActiveConnection = MM_Conn_Deepcar_STRING
RS_List.Source = "SELECT * FROM products WHERE prodgroup = '" + Replace(RS_List__MMColParam, "'", "''"
+ "'"
RS_List.CursorType = 0
RS_List.CursorLocation = 2
RS_List.LockType = 3
RS_List.Open()
RS_List_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = 10
Dim Repeat1__index
Repeat1__index = 0
RS_List_numRows = RS_List_numRows + Repeat1__numRows
%>
Is this enough for you to work with.
Best Regards
Davrus
SELECT *
FROM products
WHERE prodgroup = 'MMColParam'
MMColParam * Request.QueryString("mnu_product"

mnu_product is the text box from a search form.
This is the ASP.
<%
set RS_List = Server.CreateObject("ADODB.Recordset"

RS_List.ActiveConnection = MM_Conn_Deepcar_STRING
RS_List.Source = "SELECT * FROM products WHERE prodgroup = '" + Replace(RS_List__MMColParam, "'", "''"

RS_List.CursorType = 0
RS_List.CursorLocation = 2
RS_List.LockType = 3
RS_List.Open()
RS_List_numRows = 0
%>
<%
Dim Repeat1__numRows
Repeat1__numRows = 10
Dim Repeat1__index
Repeat1__index = 0
RS_List_numRows = RS_List_numRows + Repeat1__numRows
%>
Is this enough for you to work with.
Best Regards
Davrus
Replied 15 Jul 2002 13:31:01
15 Jul 2002 13:31:01 Julio Taylor replied:
ok,
what you'll need to do is create a second recordset, using the following SQL:
<pre id=code><font face=courier size=2 id=code>
SELECT SUM(fieldname) FROM products WHERE prodgroup= 'MMColParam'
</font id=code></pre id=code>
the second recordset should provide a sum of the records, based on the criteria you have specified. let me know if you get any problems with this.
------------------------
Poolio
MSN:
www.eliziumdesign.com
what you'll need to do is create a second recordset, using the following SQL:
<pre id=code><font face=courier size=2 id=code>
SELECT SUM(fieldname) FROM products WHERE prodgroup= 'MMColParam'
</font id=code></pre id=code>
the second recordset should provide a sum of the records, based on the criteria you have specified. let me know if you get any problems with this.
------------------------
Poolio
MSN:
www.eliziumdesign.com