Results 1 to 5 of 5
Jun 6, 2013, 10:46 #1
- Join Date
- Jun 2013
- 0 Post(s)
- 0 Thread(s)
How do I display parts of queried data in different sections of output?
I'm hoping someone can help. Here's my problem.
Lets say I'm building a report where I query SQL for data and display the individual lines and show a sum at the bottom...
<% do until rsData.EOF %> <tr> <td><%=rs("NAME")%></td> <td><%=rs("SALES")%></td> </tr> <% TTL_SALE = TTL_SALE + rs("SALES") rsData.MoveNext loop rsData.Close %> <tr> <td>TOTAL</td> <td><%=TTL_SALE%></td> </tr>
Now lets say I want to show the TOTAL at the top, before the detail.
So how does one go about getting the sum appear at the top before the detail, without having the query the SQL server twice ... once for the TOTAL and again for the detail? Is it possible to setup the SQL query as a function, or a way to pull the SQL data into cache to display in different parts of a page?