• Post Reply Bookmark Topic Watch Topic
  • New Topic

Subtotals  RSS feed

 
K Robert
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following which I wouldl like to subtotal on the next line. Any suggestions?
while(SQLResult.next())
{
actual_date = SQLResult.getString("actual_date");
sbu = SQLResult.getString("sbu");
sum_dollar = SQLResult.getString("sum_dollar");
sum_cases = SQLResult.getString("sum_cases");
yield = SQLResult.getString("yield");
new_order_cases = SQLResult.getString("new_order_cases");
total_open_orders = SQLResult.getString("total_open_orders");
back_orders = SQLResult.getString("back_orders");
out.println("<tr>");
out.println("<td align=center><font face='Arial' size='1' color='#737173'>" + actual_date + "</font></td>");
out.println("<td align=center><font face='Arial' size='1'>" + sbu + "</font></td>");
out.println("<td align=right><font face='Arial' size='1'>" + sum_dollar + "</font></td>");
out.println("<td align=center><font face='Arial' size='1'>" + sum_cases + "</font></td>");
out.println("<td align=center><font face='Arial' size='1'>" + yield + "</font></td>");
out.println("<td align=center><font face='Arial' size='1'>" + new_order_cases + "</font></td>");
out.println("<td align=center><font face='Arial' size='1'>" + total_open_orders + "</font></td>");
out.println("<td align=center><font face='Arial' size='1'>" + back_orders + "</font></td>");
if (sbu.equals("P"))
{
out.println("<tr><td> </td></tr>");
}
out.println("</tr>");

}
 
Ron Newman
Ranch Hand
Posts: 1056
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could either issue another SQL query with sum() expressions, or do the sums yourself ... but either way, what does this have to do with JSP?
 
K Robert
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am doing this in a jsp page. I am sure how to tackle the "sum" in the jsp.
Thanks
 
K Robert
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, I can get the totals through another query but, am not sure how to insert them in the while loop for each date.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!